From 342cfc469ad281a7d8c7a07d7f40354b7bc84194 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 25 Oct 2024 10:37:34 +0200 Subject: [PATCH] Update the network download method to POST and return value --- src/data/data.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/data.ts b/src/data/data.ts index 5b4a8f5..2179c76 100644 --- a/src/data/data.ts +++ b/src/data/data.ts @@ -130,11 +130,11 @@ export class CodexData { * Download a file from the network in a streaming manner. * If the file is not available locally, it will be retrieved from other nodes in the network if able. */ - async networkDownload(cid: string) { + async networkDownload(cid: string): Promise | null>> { const url = this.url + Api.config.prefix + `/data/${cid}/network`; const res = await Fetch.safe(url, { - method: "GET", + method: "POST", headers: { "content-type": "application/octet-stream", }, @@ -144,7 +144,7 @@ export class CodexData { return res; } - return res.data.body; + return { error: false, data: res.data.body }; } /**