rarepress icon indicating copy to clipboard operation
rarepress copied to clipboard

cid.startsWith is not a function

Open kalpshah18 opened this issue 4 years ago • 1 comments

C:\Users\dimpa\node_modules\nebulus\index.js:147 const filePath = (cid.startsWith("/ipfs/") ? ${this.storage}${cid} : ${this.storage}/ipfs/${cid}) ^

TypeError: cid.startsWith is not a function at Network.upload (C:\Users\dimpa\node_modules\nebulus\index.js:147:27) at async C:\Users\dimpa\Documents\KalpProjectsCoding\generateNFT\index.js:16:9

kalpshah18 avatar Jan 02 '22 14:01 kalpshah18

This happened to me, the Buffer you are using to create the file and get the cid is null, if you are using fs.readfile, the first argument is the error, the second one are the actual bytes, so make the callback function like this (err, bytes) =>

Bloodday avatar Jan 21 '22 04:01 Bloodday