Docs

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 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);

Parameters

Returns

The URIs of the uploaded data