Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

docs: documenting importer options #107

Merged
merged 1 commit into from
Jan 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions API/files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ files API

##### `Go` **WIP**

##### `JavaScript` - ipfs.files.add(data, [callback])
##### `JavaScript` - ipfs.files.add(data, [options], [callback])

Where `data` may be

Expand All @@ -23,6 +23,8 @@ Where `data` may be

If no `content` is passed, then the path is treated as an empty directory

`options` is an optional object argument containing the [DAG importer options](https://github.com/ipfs/js-ipfs-unixfs-engine#importer-api).

`callback` must follow `function (err, res) {}` signature, where `err` is an error if the operation was not successful. `res` will be an array of:

```js
Expand Down Expand Up @@ -56,7 +58,7 @@ ipfs.files.add(files, function (err, files) {

##### `Go` **WIP**

##### `JavaScript` - ipfs.files.createAddStream([callback])
##### `JavaScript` - ipfs.files.createAddStream([options], [callback])

Provides a Transform stream, where objects can be written of the forms

Expand All @@ -67,6 +69,8 @@ Provides a Transform stream, where objects can be written of the forms
}
```

`options` is an optional object argument containing the [DAG importer options](https://github.com/ipfs/js-ipfs-unixfs-engine#importer-api).

`callback` must follow `function (err, stream) {}` signature, where `err` is an
error if the operation was not successful. `stream` will be a Transform stream,
to which tuples like the above two object formats can be written and [DAGNode][]
Expand Down Expand Up @@ -105,7 +109,7 @@ ipfs.files.createAddStream(function (err, stream) {

`multihash` is a [multihash][] which can be passed as

- Buffer, the raw Buffer of the multihash
- Buffer, the raw Buffer of the multihash
- String, the base58 encoded version of the multihash

`callback` must follow `function (err, stream) {}` signature, where `err` is an error if the operation was not successful and `stream` is a readable stream of the file.
Expand Down