uploadMobile

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.

Example

// 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 uploadMobile({
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 uploadMobile(objects);
function uploadMobile(
): Promise<Array<string>>;

Parameters

Options to pass through to the storage uploader class

Type

let options: InternalUploadMobileOptions & { client: ThirdwebClient };

Returns

let returnType: Promise<Array<string>>;

The URIs of the uploaded data