Custom Storage
Easily upload and fetch files from IPFS.
Upload
- React
- Javascript
- Python
- Go
const sdk = useSDK();
// 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}`);
},
});
// 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}`);
},
});
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
- React
- Javascript
- Python
- Go
const sdk = useSDK();
// Your IPFS hash here
const hash = "ipfs://..."
const data = await sdk.storage.fetch(hash);
// Your IPFS hash here
const hash = "ipfs://..."
const data = await sdk.storage.fetch(hash);
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!