You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Hello, I'm using the ipfs-js-api and am having a problem with ipfs.files.add() when adding a Buffer.
I'm following the this usage example from js-ipfs-api/examples/name-api/index.js:
letbuffer=Buffer.from(input.value)ipfs.add(buffer).then(res=>{publish(res[0].path)input.value=''}).catch(err=>{showStatus('failed to add the data',COLORS.error)console.error(err)})}
Error: "files" must be a buffer, readable stream, or array of objects
In the browser, I can solve the problem by putting the Buffer inside an array (I don't know why that solves it though...):
ipfs.files.add([myBuffer],function(err,result){
But in Node.js I get this error:
TypeError: content.once is not a function
at Multipart._pushFile ($proj/src/node_modules/ipfs-api/src/utils/multipart.js:80:13)
at Multipart._maybeDrain ($proj/src/node_modules/ipfs-api/src/utils/multipart.js:48:14)
at Multipart._transform ($proj/src/node_modules/ipfs-api/src/utils/multipart.js:40:10)
at Multipart.Transform._read (_stream_transform.js:167:10)
at Multipart.Transform._write (_stream_transform.js:155:12)
at doWrite (_stream_writable.js:307:12)
at writeOrBuffer (_stream_writable.js:293:5)
at Multipart.Writable.write (_stream_writable.js:220:11)
at eachSeries ($proj/src/node_modules/ipfs-api/src/utils/send-files-stream.js:52:35)
at $proj/src/node_modules/async/internal/withoutIndex.js:9:16
Does anyone have any idea why this happens?
Thanks :)