I'm using Pinata's pinFileToIPFS()
function that requires a ReadableStream to upload to Pinata's IPFS nodes. I have the bytearray of the file, for example of a PNG.
I want to convert this byteArray to readableStream and upload this on IPFS.
How can i convert that in typescript?
export async function putFileToIPFS(file:any): Promise<string>{
readableStream = ** CONVERT FILE TO READABLE **
let cid ;
try {
cid = await pinata.pinFileToIPFS(readableStream)
console.log(cid)
}
catch (error) { console.error(error);}
return cid['IpfsHash']
}
Thanks