Skip to main content

RemoteStorage.upload() method

Upload any data to an IPFS directory. We'll handle all the details for you, including pinning your files and making sure that you get the fastest upload speeds.


// File upload
const files = [fs.readFileSync("file1.png"), fs.readFileSync("file2.png")];
const result = await;
// uri for each uploaded file will look like something like: ipfs://<hash>/0

// JSON metadata upload
const jsonMetadata = {
name: "Name",
description: "Description",
const result = await;

// Upload progress (browser only)
const result = await, {
onProgress: (event: UploadProgressEvent) => {
console.log(`Downloaded ${event.progress} / ${}`);


upload(data: FileOrBuffer[] | JsonObject[] | FileOrBuffer | JsonObject, options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<UploadResult>;


dataFileOrBuffer[] | JsonObject[] | FileOrBuffer | JsonObjectAn array of file data or an array of JSON metadata to upload to IPFS
options{ onProgress: (event: UploadProgressEvent) => void; }(Optional) Optional. Upload progress callback.



The IPFS hash of the directory that holds all the uploaded data