mirror of
https://github.com/logos-storage/logos-storage-js.git
synced 2026-01-08 00:13:06 +00:00
Update the network download method to POST and return value
This commit is contained in:
parent
b059830cec
commit
342cfc469a
@ -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<SafeValue<ReadableStream<Uint8Array> | 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 };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user