Optional
options: ThirdwebStorageOptions<T>Private
Optional
clientPrivate
downloaderPrivate
gatewayPrivate
uploaderDownloads JSON data from any URL scheme. Resolves any URLs with schemes to retrievable gateway URLs.
The URL of the JSON data to download
Optional
options: SingleDownloadOptionsThe JSON data fetched from the resolved URL
const uri = "ipfs://example";
const json = await storage.downloadJSON(uri);
Upload arbitrary file or JSON data using the configured decentralized storage system. Automatically uploads any file data within JSON objects and replaces them with hashes.
Arbitrary file or JSON data to upload
Optional
options: TOptions to pass through to the storage uploader class
// Upload an image
launchImageLibrary({mediaType: 'photo'}, async response => {
if (response.assets?.[0]) {
const {fileName, type, uri} = response.assets[0];
if (!uri) {
throw new Error('No uri');
}
const resp = await storage.upload({
uri,
type,
name: fileName,
});
}
});
const jsonUri = await storage.upload(json);
Batch upload arbitrary file or JSON data using the configured decentralized storage system. Automatically uploads any file data within JSON objects and replaces them with hashes.
Array of arbitrary file or JSON data to upload
Optional
options: TOptions to pass through to the storage uploader class
// Upload an image
launchImageLibrary({mediaType: 'photo'}, async response => {
if (response.assets?.[0]) {
const {fileName, type, uri} = response.assets[0];
if (!uri) {
throw new Error('No uri');
}
const resp = await storage.upload({
uri,
type,
name: fileName,
});
}
});
// Upload an array of JSON objects
const objects = [
{ name: "JSON 1", text: "Hello World" },
{ name: "JSON 2", trait: "Awesome" },
];
const jsonUris = await storage.uploadBatch(objects);
Generated using TypeDoc
Downloads arbitrary data from any URL scheme.