download

Example

Download a file from IPFS:

import { download } from "thirdweb/storage";
import { createThirdwebClient } from "@thirdweb-dev/sdk";
const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
const file = await download({
client,
uri: "ipfs://Qm...",
});

Download a file from Arweave:

import { download } from "thirdweb/storage";
import { createThirdwebClient } from "@thirdweb-dev/sdk";
const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
const file = await download({
client,
uri: "ar://{arweave-transaction-id}",
});

Download a file from HTTP:

import { download } from "thirdweb/storage";
import { createThirdwebClient } from "@thirdweb-dev/sdk";
const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
const file = await download({
client,
uri: "https://example.com/file.txt",
});
function download(options: {
client: ThirdwebClient;
requestTimeoutMs?: number;
uri: string;
}): Promise<Response>;

Parameters

The download options.

Type

let options: {
client: ThirdwebClient;
requestTimeoutMs?: number;
uri: string;
};

Returns

let returnType: Promise<Response>;

Asynchronously returns the network response from fetching the file.