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

docs: add note about the effect mode and mtime on cids #3350

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 10 additions & 8 deletions docs/core-api/FILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ 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 more information.

##### FileContent

`FileContent` is one of the following types:
Expand Down Expand Up @@ -186,8 +188,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 +270,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 +460,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 present - 0644 for files, 0755 for directories
mtime?: { secs: Number, nsecs: Number },
}
```

Expand Down Expand Up @@ -522,8 +524,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 present - 0644 for files, 0755 for directories
mtime?: { secs: Number, nsecs: Number },
}
```

Expand Down