This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Error passing a filepath string to files.add #722
Closed
Description
The interface spec suggests that from node you can call ipfs.add
with a Path.
https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/FILES.md#add
ipfs.files.add(data, [options], [callback])
Wheredata
may be:
a Buffer instance
a Readable Stream
a Pull Stream
a Path (caveat: will only work in Node.js)
a URL
an array of objects
Trying to pass a file system path as a string throws an error
Error: first arg must be a buffer, readable stream, an object or array of objects
at Function.promisify (/Users/oli/Code/ipfs/js-ipfs-api/src/files/add.js:34:23)
at Object.add (/Users/oli/Code/ipfs/js-ipfs-api/node_modules/promisify-es6/index.js:32:27)
at Object.<anonymous> (/Users/oli/Code/ipfs/js-ipfs-api/examples/files-api/files-api.js:19:12)
Do I need to update the spec, or fix the implementation?