Hi, guys.
Can anybody explain what kind of someBinaryImageData we use in nft.storage client.store()? What it should be and how do we extract it?
const imageFile = new File([ someBinaryImageData ], 'nft.png', { type: 'image/png' })

Feb 8, 2023, 5:54 PM
it's binary data of a file, if you want to pass an image, do something like
blob = new Blob([fs.readFileSync(path_of_file)])
Blob is from nft.storage library
Feb 8, 2023, 5:57 PM
ty, i have to test it
Actually I'm getting an error of cannot read undefined, reading 'readFileSync' or 'readFile' - tried importing 'fs' to my component in different ways, but it doesn't work, so i managed to solve it by getting reader.readAsArrayBuffer(file), and reader.readAsBinaryString(file) and the payload is pretty much similar to what is expected in the payload of the function that uploads files manually in nft.storage personal account, and i got 200ok response from nft.storage, but file downloads with 0 B size to nft.storage, they're shown in the queuing status. A little bit stuck here.
Feb 8, 2023, 7:39 PM

© 2024 Draquery.com All rights reserved.