Download a file from IPFS:
import { download } from "thirdweb/storage";import { createThirdwebClient } from "thirdweb"; 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"; 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"; 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>;
The download options.
let options: { client: ThirdwebClient; requestTimeoutMs?: number; uri: string;};
let returnType: Promise<Response>;
Asynchronously returns the network response from fetching the file.