Custom Storage
Easily upload and fetch files from IPFS.
Upload
- Javascript
- React
- Python
- Go
// File upload
const files = [
fs.readFileSync("file1.png"),
fs.readFileSync("file2.png"),
]
const result = await sdk.storage.upload(files);
// 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 sdk.storage.upload(jsonMetadata);
// Upload progress (browser only)
const result = await sdk.storage.upload(files, {
onProgress: (event: UploadProgressEvent) => {
console.log(`Downloaded ${event.progress} / ${event.total}`);
},
});
React SDK support for upload is coming soon.
Want this feature sooner? Let us know in Discord!
Python SDK support for upload is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for upload is coming soon.
Want this feature sooner? Let us know in Discord!
Fetch
- Javascript
- React
- Python
- Go
// Your IPFS hash here
const hash = "ipfs://..."
const data = await sdk.storage.fetch(hash);
React SDK support for fetch is coming soon.
Want this feature sooner? Let us know in Discord!
Python SDK support for fetch is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for fetch is coming soon.
Want this feature sooner? Let us know in Discord!