Skip to content
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
@olizilla

Description

@olizilla

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])
Where data 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?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions