Skip to main content

IStorage.upload() method

Uploads a file to the storage.

Signature:

upload(data: string | FileOrBuffer, contractAddress?: string, signerAddress?: string, options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<string>;

Parameters

ParameterTypeDescription
datastring | FileOrBufferThe data to be uploaded. Can be a file/buffer (which will be loaded), or a string.
contractAddressstring(Optional) Optional. The contract address the data belongs to.
signerAddressstring(Optional) Optional. The address of the signer.
options{ onProgress: (event: UploadProgressEvent) => void; }(Optional) Optional. Upload progress callback.

Returns:

Promise<string>

  • The hash of the uploaded data.