Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

docs: clarify that mtime and mode are optional #3302

Merged
merged 2 commits into from
Oct 27, 2020
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
20 changes: 12 additions & 8 deletions docs/core-api/FILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ If no `content` is passed, then the item is treated as an empty directory.

One of `path` or `content` _must_ be passed.

Both `mode` and `mtime` are optional and will result in different [CID][]s for the same file if passed.

`mode` will have a default value applied if not set, see [UnixFS Metadata](https://github.com/ipfs/specs/blob/master/UNIXFS.md#metadata) for further discussion.

##### FileContent

`FileContent` is one of the following types:
Expand Down Expand Up @@ -186,8 +190,8 @@ Each yielded object is of the form:
{
path: '/tmp/myfile.txt',
cid: CID('QmHash'),
mode: Number,
mtime: { secs: Number, nsecs: Number },
mode: Number, // implicit if not provided - 0644 for files, 0755 for directories
mtime?: { secs: Number, nsecs: Number },
size: 123
}
```
Expand Down Expand Up @@ -268,8 +272,8 @@ Each yielded object is of the form:
{
path: '/tmp/myfile.txt',
cid: CID('QmHash'),
mode: Number,
mtime: { secs: Number, nsecs: Number },
mode: Number, // implicit if not provided - 0644 for files, 0755 for directories
mtime?: { secs: Number, nsecs: Number },
size: 123
}
```
Expand Down Expand Up @@ -458,8 +462,8 @@ Each yielded object is of the form:
{
path: string,
content: <AsyncIterable<Uint8Array>>,
mode: number,
mtime: { secs: number, nsecs: number }
mode: Number, // implicit if not provided - 0644 for files, 0755 for directories
mtime?: { secs: Number, nsecs: Number }
}
```

Expand Down Expand Up @@ -522,8 +526,8 @@ Each yielded object is of the form:
size: 11696,
cid: CID('QmZyUEQVuRK3XV7L9Dk26pg6RVSgaYkiSTEdnT2kZZdwoi'),
type: 'file',
mode: Number,
mtime: { secs: Number, nsecs: Number }
mode: Number, // implicit if not provided - 0644 for files, 0755 for directories
mtime?: { secs: Number, nsecs: Number }
}
```

Expand Down