-
Notifications
You must be signed in to change notification settings - Fork 110
WIP Files #8
WIP Files #8
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,85 @@ test.all(common) | |
|
||
A valid (read: that follows this interface) IPFS core implementation, must expose the following API. | ||
|
||
## Group Files | ||
|
||
### `Add` | ||
|
||
> Store a Unixfs file or directory of files . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we either explain what "unixfs" means or link to a document that does? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unixfs is all lowercase |
||
|
||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.add(path, [options, callback]) | ||
|
||
`path` The path to a file to be added to IPFS. Can be of type: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe "toAdd" is a better name than "path", since it can take on many values; many of which are not paths. also not all types are files either, so maybe s/file/data? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or even call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. even |
||
|
||
- Callback, If no first argument is supplied a callback will return a duplex stream. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the semantics of this duplex stream? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/Callback/function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "If no first argument is supplied" or "if a function is supplied"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct. If no callback is passed, then a object duplex stream is returned. |
||
- Path, String format path to a file to be added to IPFS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "string, in the form of a filesystem path to a file to be added" |
||
- Stream | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what kind? readable? writeable? transform? duplex? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. readable, ty! unless duplex works too, pipe data to the through fixed sized chunker https://github.com/ipfs/js-ipfs-unixfs-engine/blob/master/src/importer.js#L67 |
||
- Object, with format `{ path: </foo/bar>, stream: <readable stream> }` | ||
- Array, an [array] of objects with the above format. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is also the option that no 1st arg is passed, a duplex stream is returned There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh good, added |
||
`options` is a optional argument of type object, that can contain the following properties: | ||
|
||
- `Recursive`. Add directory paths recursively. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do s/Recursive/recursive? it's js idiom to use camelcase names |
||
|
||
`callback` must follow `function (err, object) {}` signature, where `err` is an error if the operation was not successful and `object` is an ndjson return with properties { Name (string), Hash (multihash) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is "an ndjson return"? |
||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
|
||
|
||
|
||
|
||
### `Cat` | ||
|
||
> Displays the data contained by an IPFS object(s) at the given path.. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it "display" an object's data or does it retrieve it? Maybe "streams an IPFS object's data, given an IPFS multihash"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. according to go-ipfs |
||
|
||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.cat(multihash, [callback]) | ||
|
||
`multihash` is a [multihash]() which can be passed as: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
grammar nit: no colon needed here |
||
|
||
- Buffer, the raw Buffer of the multihash (or of and encoded version) | ||
- String, the toString version of the multihash (or of an encoded version) | ||
|
||
`callback` must follow `function (err, stream) {}` signature, where `err` is an error if the operation was not successful and `stream` is a readable stream. | ||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
|
||
|
||
|
||
|
||
### `Get` | ||
|
||
> Download IPFS UnixFS files and directories with tar archiving and gzip compression options. | ||
|
||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.get(multihash, [options, callback]) | ||
|
||
`multihash` is a [multihash]() which can be passed as: | ||
|
||
- Buffer, the raw Buffer of the multihash (or of and encoded version) | ||
- String, the toString version of the multihash (or of an encoded version) | ||
|
||
`options` is a optional argument of type object, that can contain the following properties: | ||
|
||
- `output`, string - The path where output should be stored. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "... on the local file system" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are the semantics if this is vs is not set? If set, does this give us the below duplex stream and write to the local fs? If not set, does it not write? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No output string creates files on the cwd for the cli. Not sure how this will be handled exactly yet if provided to the http-api, but that is a different spec and this probably belongs there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems a bit confusing. good layering would be to have the core just provide plain streams to the caller (idempotent; doesn't mutate global fs), and let downstream (e.g. cli) implement things like fs writes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed, think i was trying to add documentation from what the cli/http server would handle the streams. Core will simply be streams. |
||
- `archive`, bool - Output a TAR archive. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for each file? for the entire file+directory structure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have not figured that one out yet :D |
||
- `compress`, bool - Compress the output with GZIP compression. | ||
- `compression-level` int - The level of compression (1-9). | ||
|
||
`callback` must follow `function (err, ee) {}` signature, where `err` is an error if the operation was not successful and `ee` is an event emitter containing an object of {stream, path, dir} where dir is a boolean flag for a directory path. [ee](https://github.com/ipfs/js-ipfs-unixfs-engine/blob/master/src/exporter.js) // This should be upgraded to duplex object stream. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are moving and defining the spec. Let's move the 'exporter' to become a duplex stream instead of an event emitter, otherwise it will be a lil strange why one is EE and another is DuplexStream. This way we will be also able to leverage the streams properties. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Completely agree! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need for a duplex stream on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as the stream can stay an object stream for getting paths back, https://github.com/ipfs/js-ipfs-unixfs-engine/blob/master/src/exporter.js#L55 |
||
|
||
If no `callback` is passed, a promise is returned. | ||
|
||
|
||
|
||
|
||
|
||
## Object | ||
|
||
### `object.new` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "Group Files" a canonical api section name? I haven't seen this referred to anywhere -- could you link me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Group is used it seems for the top level commands in the apiary, and group files is already taken from the mfs group, nomenclature ftw! we should talk more on what we call commands in ipfs in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this just an apiary thing, or does putting the word "group" in front of everything add extra value to the reader?