You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Copy file name to clipboardexpand all lines: docs/core-api/FILES.md
+12-8
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,10 @@ If no `content` is passed, then the item is treated as an empty directory.
138
138
139
139
One of `path` or `content`_must_ be passed.
140
140
141
+
Both `mode` and `mtime` are optional and will result in different [CID][]s for the same file if passed.
142
+
143
+
`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.
144
+
141
145
##### FileContent
142
146
143
147
`FileContent` is one of the following types:
@@ -186,8 +190,8 @@ Each yielded object is of the form:
186
190
{
187
191
path:'/tmp/myfile.txt',
188
192
cid:CID('QmHash'),
189
-
mode:Number,
190
-
mtime: { secs:Number, nsecs:Number },
193
+
mode:Number,// implicit if not provided - 0644 for files, 0755 for directories
194
+
mtime?: { secs:Number, nsecs:Number },
191
195
size:123
192
196
}
193
197
```
@@ -268,8 +272,8 @@ Each yielded object is of the form:
268
272
{
269
273
path:'/tmp/myfile.txt',
270
274
cid:CID('QmHash'),
271
-
mode:Number,
272
-
mtime: { secs:Number, nsecs:Number },
275
+
mode:Number,// implicit if not provided - 0644 for files, 0755 for directories
276
+
mtime?: { secs:Number, nsecs:Number },
273
277
size:123
274
278
}
275
279
```
@@ -458,8 +462,8 @@ Each yielded object is of the form:
458
462
{
459
463
path: string,
460
464
content:<AsyncIterable<Uint8Array>>,
461
-
mode:number,
462
-
mtime: { secs:number, nsecs:number }
465
+
mode:Number, // implicit if not provided - 0644 for files, 0755 for directories
466
+
mtime?: { secs:Number, nsecs:Number }
463
467
}
464
468
```
465
469
@@ -522,8 +526,8 @@ Each yielded object is of the form:
0 commit comments