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

Commit ef72fa9

Browse files
achingbrainalanshaw
authored andcommitted
docs: add cid-base and missing ls options for mfs operations (#334)
Documents the new options added by ipfs/js-ipfs#1454 as well as the missing `long` option from `files.ls`
1 parent 34c3fc6 commit ef72fa9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

SPEC/FILES.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ If no `content` is passed, then the path is treated as an empty directory
160160
- wrapWithDirectory (boolean): adds a wrapping node around the content.
161161
- onlyHash (boolean): doesn't actually add the file to IPFS, but rather calculates its hash.
162162
- pin (boolean, default true): pin this object when adding.
163+
- raw-leaves (boolean, default false): if true, DAG leaves will contain raw file data and not be wrapped in a protobuf
163164

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

@@ -696,6 +697,7 @@ Where:
696697
- `hash` is a Boolean value to return only the hash (default: false)
697698
- `size` is a Boolean value to return only the size (default: false)
698699
- `withLocal` is a Boolean value to compute the amount of the dag that is local, and if possible the total size (default: false)
700+
- `cidBase` is which number base to use to format hashes - e.g. `base32`, `base64` etc (default: `base58btc`)
699701
- `callback` is an optional function with the signature `function (error, stats) {}`, where `error` may be an Error that occured if the operation was not successful and `stats` is an Object with the following keys:
700702

701703
- `hash` is a string with the hash
@@ -874,6 +876,8 @@ Where:
874876
- `create` is a Boolean to indicate to create the file if it doesn't exist (default: false)
875877
- `truncate` is a Boolean to indicate if the file should be truncated after writing all the bytes from `content` (default: false)
876878
- `length` is an Integer with the maximum number of bytes to read (default: Read all bytes from `content`)
879+
- `raw-leaves`: if true, DAG leaves will contain raw file data and not be wrapped in a protobuf (boolean, default false)
880+
- `cid-version`: the CID version to use when storing the data (storage keys are based on the CID, including it's version) (integer, default 0)
877881
- `callback` is an optional function with the signature `function (error) {}`, where `error` may be an Error that occured if the operation was not successful
878882

879883
If no `callback` is passed, a promise is returned.
@@ -970,11 +974,14 @@ ipfs.files.flush('/', (err) => {
970974
971975
##### `Go` **WIP**
972976

973-
##### `JavaScript` - ipfs.files.ls([path], [callback])
977+
##### `JavaScript` - ipfs.files.ls([path], [options], [callback])
974978

975979
Where:
976980

977981
- `path` is an optional string to show listing for (default: `/`)
982+
- `options` is an optional Object that might contain the following keys:
983+
- `long` is a Boolean value to decide whether or not to populate `type`, `size` and `hash` (default: false)
984+
- `cidBase` is which number base to use to format hashes - e.g. `base32`, `base64` etc (default: `base58btc`)
978985
- `callback` is an optional function with the signature `function (error, files) {}`, where `error` may be an Error that occured if the operation was not successful and `files` is an array containing Objects that contain the following keys:
979986

980987
- `name` which is the file's name

0 commit comments

Comments
 (0)