IpfsStorage.upload() method
Upload a file to IPFS and return the hash
Example
const file = "./path/to/file.png"; // Can be a path or a File object such as a file from an input element.
const hash = await sdk.storage.upload(file);
Signature:
upload(data: string | FileOrBuffer, contractAddress?: string, signerAddress?: string, options?: {
onProgress: (event: UploadProgressEvent) => void;
}): Promise<string>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| data | string | FileOrBuffer | |
| contractAddress | string | (Optional) |
| signerAddress | string | (Optional) |
| options | { onProgress: (event: UploadProgressEvent) => void; } | (Optional) |
Returns:
Promise<string>
Remarks
This method is a wrapper around IStorage.upload()