@helia/unixfs 1.4.2 → 2.0.0-10272b4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -16
- package/dist/index.min.js +1 -1
- package/dist/src/commands/cat.js.map +1 -1
- package/dist/src/commands/chmod.js.map +1 -1
- package/dist/src/commands/cp.js.map +1 -1
- package/dist/src/commands/ls.js.map +1 -1
- package/dist/src/commands/mkdir.js.map +1 -1
- package/dist/src/commands/rm.js.map +1 -1
- package/dist/src/commands/stat.js.map +1 -1
- package/dist/src/commands/touch.js.map +1 -1
- package/dist/src/commands/utils/add-link.js.map +1 -1
- package/dist/src/commands/utils/cid-to-directory.js.map +1 -1
- package/dist/src/commands/utils/cid-to-pblink.js.map +1 -1
- package/dist/src/commands/utils/consumable-hash.js.map +1 -1
- package/dist/src/commands/utils/dir-sharded.js.map +1 -1
- package/dist/src/commands/utils/hamt-utils.js.map +1 -1
- package/dist/src/commands/utils/is-over-shard-threshold.js.map +1 -1
- package/dist/src/commands/utils/persist.js.map +1 -1
- package/dist/src/commands/utils/remove-link.js.map +1 -1
- package/dist/src/commands/utils/resolve.js.map +1 -1
- package/dist/src/index.d.ts +16 -16
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/utils/glob-source.d.ts.map +1 -1
- package/dist/src/utils/glob-source.js +2 -1
- package/dist/src/utils/glob-source.js.map +1 -1
- package/dist/src/utils/to-mtime.d.ts +4 -0
- package/dist/src/utils/to-mtime.d.ts.map +1 -0
- package/dist/src/utils/to-mtime.js +42 -0
- package/dist/src/utils/to-mtime.js.map +1 -0
- package/dist/src/utils/url-source.js.map +1 -1
- package/package.json +22 -17
- package/src/index.ts +16 -16
- package/src/utils/glob-source.ts +2 -1
- package/src/utils/to-mtime.ts +57 -0
- package/dist/typedoc-urls.json +0 -54
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function toMtime(mtimeLike) {
|
|
2
|
+
if (mtimeLike == null) {
|
|
3
|
+
return undefined;
|
|
4
|
+
}
|
|
5
|
+
if (isMtime(mtimeLike)) {
|
|
6
|
+
return mtimeLike;
|
|
7
|
+
}
|
|
8
|
+
if (mtimeLike instanceof Date) {
|
|
9
|
+
return dateToTimespec(mtimeLike);
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(mtimeLike)) {
|
|
12
|
+
const output = {
|
|
13
|
+
secs: BigInt(mtimeLike[0])
|
|
14
|
+
};
|
|
15
|
+
if (mtimeLike.length > 1) {
|
|
16
|
+
output.nsecs = mtimeLike[1];
|
|
17
|
+
}
|
|
18
|
+
return output;
|
|
19
|
+
}
|
|
20
|
+
if (typeof mtimeLike.Seconds === 'number') {
|
|
21
|
+
const output = {
|
|
22
|
+
secs: BigInt(mtimeLike.Seconds)
|
|
23
|
+
};
|
|
24
|
+
if (mtimeLike.FractionalNanoseconds != null) {
|
|
25
|
+
output.nsecs = mtimeLike.FractionalNanoseconds;
|
|
26
|
+
}
|
|
27
|
+
return output;
|
|
28
|
+
}
|
|
29
|
+
throw new Error('Cannot convert object to mtime');
|
|
30
|
+
}
|
|
31
|
+
function dateToTimespec(date) {
|
|
32
|
+
const ms = date.getTime();
|
|
33
|
+
const secs = Math.floor(ms / 1000);
|
|
34
|
+
return {
|
|
35
|
+
secs: BigInt(secs),
|
|
36
|
+
nsecs: (ms - (secs * 1000)) * 1000
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function isMtime(obj) {
|
|
40
|
+
return typeof obj.secs === 'bigint';
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=to-mtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-mtime.js","sourceRoot":"","sources":["../../../src/utils/to-mtime.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,OAAO,CAAE,SAAqB;IAC5C,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;QACtB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,IAAI,SAAS,YAAY,IAAI,EAAE,CAAC;QAC9B,OAAO,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAU;YACpB,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC3B,CAAA;QAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;QAC7B,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAU;YACpB,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC;SAChC,CAAA;QAED,IAAI,SAAS,CAAC,qBAAqB,IAAI,IAAI,EAAE,CAAC;YAC5C,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,qBAAqB,CAAA;QAChD,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;AACnD,CAAC;AAED,SAAS,cAAc,CAAE,IAAU;IACjC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;IACzB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAA;IAElC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;QAClB,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI;KACnC,CAAA;AACH,CAAC;AAED,SAAS,OAAO,CAAE,GAAQ;IACxB,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAA;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-source.js","sourceRoot":"","sources":["../../../src/utils/url-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,MAAM,UAAU,SAAS,CAAE,GAAQ,EAAE,OAAqB;IACxD,OAAO;QACL,IAAI,EAAE,kBAAkB,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QACtE,OAAO,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC;KACtC,CAAA;AACH,CAAC;AAED,KAAK,SAAU,CAAC,CAAC,cAAc,CAAE,GAAQ,EAAE,OAAqB;IAC9D,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAErD,IAAI,QAAQ,CAAC,IAAI,IAAI,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"url-source.js","sourceRoot":"","sources":["../../../src/utils/url-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAG3C,MAAM,UAAU,SAAS,CAAE,GAAQ,EAAE,OAAqB;IACxD,OAAO;QACL,IAAI,EAAE,kBAAkB,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QACtE,OAAO,EAAE,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC;KACtC,CAAA;AACH,CAAC;AAED,KAAK,SAAU,CAAC,CAAC,cAAc,CAAE,GAAQ,EAAE,OAAqB;IAC9D,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAErD,IAAI,QAAQ,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;QAC1B,MAAM,IAAI,YAAY,CAAC,mCAAmC,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,CAAA;IAExC,IAAI,CAAC;QACH,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;YAE3C,IAAI,IAAI,EAAE,CAAC;gBACT,OAAM;YACR,CAAC;YAED,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,WAAW,EAAE,CAAA;IACtB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/unixfs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-10272b4",
|
|
4
4
|
"description": "A Helia-compatible wrapper for UnixFS",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/ipfs/helia
|
|
6
|
+
"homepage": "https://github.com/ipfs/helia/tree/main/packages/unixfs#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/ipfs/helia
|
|
9
|
+
"url": "git+https://github.com/ipfs/helia.git"
|
|
10
10
|
},
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/ipfs/helia
|
|
12
|
+
"url": "https://github.com/ipfs/helia/issues"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public",
|
|
16
|
+
"provenance": true
|
|
13
17
|
},
|
|
14
18
|
"keywords": [
|
|
15
19
|
"IPFS"
|
|
@@ -51,6 +55,7 @@
|
|
|
51
55
|
"eslintConfig": {
|
|
52
56
|
"extends": "ipfs",
|
|
53
57
|
"parserOptions": {
|
|
58
|
+
"project": true,
|
|
54
59
|
"sourceType": "module"
|
|
55
60
|
}
|
|
56
61
|
},
|
|
@@ -154,13 +159,12 @@
|
|
|
154
159
|
"release": "aegir release"
|
|
155
160
|
},
|
|
156
161
|
"dependencies": {
|
|
157
|
-
"@helia/interface": "
|
|
158
|
-
"@ipld/dag-pb": "^4.0.
|
|
159
|
-
"@libp2p/interface": "^
|
|
160
|
-
"@libp2p/logger": "^
|
|
162
|
+
"@helia/interface": "3.0.0-10272b4",
|
|
163
|
+
"@ipld/dag-pb": "^4.0.3",
|
|
164
|
+
"@libp2p/interface": "^1.1.1",
|
|
165
|
+
"@libp2p/logger": "^4.0.4",
|
|
161
166
|
"@multiformats/murmur3": "^2.1.2",
|
|
162
167
|
"hamt-sharding": "^3.0.2",
|
|
163
|
-
"interface-blockstore": "^5.0.0",
|
|
164
168
|
"ipfs-unixfs": "^11.0.0",
|
|
165
169
|
"ipfs-unixfs-exporter": "^13.1.0",
|
|
166
170
|
"ipfs-unixfs-importer": "^15.1.0",
|
|
@@ -168,20 +172,21 @@
|
|
|
168
172
|
"it-last": "^3.0.1",
|
|
169
173
|
"it-pipe": "^3.0.1",
|
|
170
174
|
"merge-options": "^3.0.4",
|
|
171
|
-
"multiformats": "^
|
|
175
|
+
"multiformats": "^13.0.0",
|
|
172
176
|
"progress-events": "^1.0.0",
|
|
173
|
-
"sparse-array": "^1.3.2"
|
|
177
|
+
"sparse-array": "^1.3.2",
|
|
178
|
+
"uint8arrays": "^5.0.1"
|
|
174
179
|
},
|
|
175
180
|
"devDependencies": {
|
|
176
|
-
"aegir": "^
|
|
177
|
-
"blockstore-core": "^4.
|
|
181
|
+
"aegir": "^42.0.1",
|
|
182
|
+
"blockstore-core": "^4.3.8",
|
|
178
183
|
"delay": "^6.0.0",
|
|
184
|
+
"interface-blockstore": "^5.2.9",
|
|
179
185
|
"iso-url": "^1.2.1",
|
|
180
|
-
"it-all": "^3.0.
|
|
181
|
-
"it-drain": "^3.0.
|
|
186
|
+
"it-all": "^3.0.4",
|
|
187
|
+
"it-drain": "^3.0.5",
|
|
182
188
|
"it-first": "^3.0.1",
|
|
183
|
-
"it-to-buffer": "^4.0.
|
|
184
|
-
"uint8arrays": "^4.0.3",
|
|
189
|
+
"it-to-buffer": "^4.0.2",
|
|
185
190
|
"wherearewe": "^2.0.1"
|
|
186
191
|
},
|
|
187
192
|
"browser": {
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* See the {@link UnixFS UnixFS interface} for all available operations.
|
|
7
7
|
*
|
|
8
|
-
* @example
|
|
8
|
+
* @example Creating files and directories
|
|
9
9
|
*
|
|
10
10
|
* ```typescript
|
|
11
11
|
* import { createHelia } from 'helia'
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
* }
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
|
-
* @example
|
|
33
|
+
* @example Recursively adding a directory
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* Node.js-compatibly environments only:
|
|
36
36
|
*
|
|
37
37
|
* ```typescript
|
|
38
38
|
* import { globSource } from '@helia/unixfs'
|
|
@@ -363,7 +363,7 @@ export interface UnixFS {
|
|
|
363
363
|
* }
|
|
364
364
|
* ```
|
|
365
365
|
*/
|
|
366
|
-
addAll
|
|
366
|
+
addAll(source: ImportCandidateStream, options?: Partial<AddOptions>): AsyncIterable<ImportResult>
|
|
367
367
|
|
|
368
368
|
/**
|
|
369
369
|
* Add a single `Uint8Array` to your Helia node as a file.
|
|
@@ -376,7 +376,7 @@ export interface UnixFS {
|
|
|
376
376
|
* console.info(cid)
|
|
377
377
|
* ```
|
|
378
378
|
*/
|
|
379
|
-
addBytes
|
|
379
|
+
addBytes(bytes: Uint8Array, options?: Partial<AddOptions>): Promise<CID>
|
|
380
380
|
|
|
381
381
|
/**
|
|
382
382
|
* Add a stream of `Uint8Array` to your Helia node as a file.
|
|
@@ -392,7 +392,7 @@ export interface UnixFS {
|
|
|
392
392
|
* console.info(cid)
|
|
393
393
|
* ```
|
|
394
394
|
*/
|
|
395
|
-
addByteStream
|
|
395
|
+
addByteStream(bytes: ByteStream, options?: Partial<AddOptions>): Promise<CID>
|
|
396
396
|
|
|
397
397
|
/**
|
|
398
398
|
* Add a file to your Helia node with optional metadata.
|
|
@@ -413,7 +413,7 @@ export interface UnixFS {
|
|
|
413
413
|
* console.info(cid)
|
|
414
414
|
* ```
|
|
415
415
|
*/
|
|
416
|
-
addFile
|
|
416
|
+
addFile(file: FileCandidate, options?: Partial<AddOptions>): Promise<CID>
|
|
417
417
|
|
|
418
418
|
/**
|
|
419
419
|
* Add a directory to your Helia node.
|
|
@@ -426,7 +426,7 @@ export interface UnixFS {
|
|
|
426
426
|
* console.info(cid)
|
|
427
427
|
* ```
|
|
428
428
|
*/
|
|
429
|
-
addDirectory
|
|
429
|
+
addDirectory(dir?: Partial<DirectoryCandidate>, options?: Partial<AddOptions>): Promise<CID>
|
|
430
430
|
|
|
431
431
|
/**
|
|
432
432
|
* Retrieve the contents of a file from your Helia node.
|
|
@@ -439,7 +439,7 @@ export interface UnixFS {
|
|
|
439
439
|
* }
|
|
440
440
|
* ```
|
|
441
441
|
*/
|
|
442
|
-
cat
|
|
442
|
+
cat(cid: CID, options?: Partial<CatOptions>): AsyncIterable<Uint8Array>
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
445
|
* Change the permissions on a file or directory in a DAG
|
|
@@ -457,7 +457,7 @@ export interface UnixFS {
|
|
|
457
457
|
* console.info(afterCid, afterStats)
|
|
458
458
|
* ```
|
|
459
459
|
*/
|
|
460
|
-
chmod
|
|
460
|
+
chmod(cid: CID, mode: number, options?: Partial<ChmodOptions>): Promise<CID>
|
|
461
461
|
|
|
462
462
|
/**
|
|
463
463
|
* Add a file or directory to a target directory.
|
|
@@ -473,7 +473,7 @@ export interface UnixFS {
|
|
|
473
473
|
* console.info(updatedCid)
|
|
474
474
|
* ```
|
|
475
475
|
*/
|
|
476
|
-
cp
|
|
476
|
+
cp(source: CID, target: CID, name: string, options?: Partial<CpOptions>): Promise<CID>
|
|
477
477
|
|
|
478
478
|
/**
|
|
479
479
|
* List directory contents.
|
|
@@ -486,7 +486,7 @@ export interface UnixFS {
|
|
|
486
486
|
* }
|
|
487
487
|
* ```
|
|
488
488
|
*/
|
|
489
|
-
ls
|
|
489
|
+
ls(cid: CID, options?: Partial<LsOptions>): AsyncIterable<UnixFSEntry>
|
|
490
490
|
|
|
491
491
|
/**
|
|
492
492
|
* Make a new directory under an existing directory.
|
|
@@ -501,7 +501,7 @@ export interface UnixFS {
|
|
|
501
501
|
* console.info(updatedCid)
|
|
502
502
|
* ```
|
|
503
503
|
*/
|
|
504
|
-
mkdir
|
|
504
|
+
mkdir(cid: CID, dirname: string, options?: Partial<MkdirOptions>): Promise<CID>
|
|
505
505
|
|
|
506
506
|
/**
|
|
507
507
|
* Remove a file or directory from an existing directory.
|
|
@@ -517,7 +517,7 @@ export interface UnixFS {
|
|
|
517
517
|
* console.info(finalCid)
|
|
518
518
|
* ```
|
|
519
519
|
*/
|
|
520
|
-
rm
|
|
520
|
+
rm(cid: CID, path: string, options?: Partial<RmOptions>): Promise<CID>
|
|
521
521
|
|
|
522
522
|
/**
|
|
523
523
|
* Return statistics about a UnixFS DAG.
|
|
@@ -532,7 +532,7 @@ export interface UnixFS {
|
|
|
532
532
|
* console.info(stats)
|
|
533
533
|
* ```
|
|
534
534
|
*/
|
|
535
|
-
stat
|
|
535
|
+
stat(cid: CID, options?: Partial<StatOptions>): Promise<UnixFSStats>
|
|
536
536
|
|
|
537
537
|
/**
|
|
538
538
|
* Update the mtime of a UnixFS DAG
|
|
@@ -550,7 +550,7 @@ export interface UnixFS {
|
|
|
550
550
|
* console.info(afterCid, afterStats)
|
|
551
551
|
* ```
|
|
552
552
|
*/
|
|
553
|
-
touch
|
|
553
|
+
touch(cid: CID, options?: Partial<TouchOptions>): Promise<CID>
|
|
554
554
|
}
|
|
555
555
|
|
|
556
556
|
class DefaultUnixFS implements UnixFS {
|
package/src/utils/glob-source.ts
CHANGED
|
@@ -3,6 +3,7 @@ import fsp from 'fs/promises'
|
|
|
3
3
|
import Path from 'path'
|
|
4
4
|
import glob from 'it-glob'
|
|
5
5
|
import { InvalidParametersError } from '../errors.js'
|
|
6
|
+
import { toMtime } from './to-mtime.js'
|
|
6
7
|
import type { MtimeLike } from 'ipfs-unixfs'
|
|
7
8
|
import type { ImportCandidateStream } from 'ipfs-unixfs-importer'
|
|
8
9
|
|
|
@@ -84,7 +85,7 @@ export async function * globSource (cwd: string, pattern: string, options: GlobS
|
|
|
84
85
|
path: toPosix(p.replace(cwd, '')),
|
|
85
86
|
content: stat.isFile() ? fs.createReadStream(p) : undefined,
|
|
86
87
|
mode,
|
|
87
|
-
mtime
|
|
88
|
+
mtime: toMtime(mtime)
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Mtime, MtimeLike } from 'ipfs-unixfs'
|
|
2
|
+
|
|
3
|
+
export function toMtime (mtimeLike: MtimeLike): Mtime
|
|
4
|
+
export function toMtime (mtimeLike?: MtimeLike): Mtime | undefined
|
|
5
|
+
export function toMtime (mtimeLike?: MtimeLike): Mtime | undefined {
|
|
6
|
+
if (mtimeLike == null) {
|
|
7
|
+
return undefined
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (isMtime(mtimeLike)) {
|
|
11
|
+
return mtimeLike
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (mtimeLike instanceof Date) {
|
|
15
|
+
return dateToTimespec(mtimeLike)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (Array.isArray(mtimeLike)) {
|
|
19
|
+
const output: Mtime = {
|
|
20
|
+
secs: BigInt(mtimeLike[0])
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (mtimeLike.length > 1) {
|
|
24
|
+
output.nsecs = mtimeLike[1]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return output
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof mtimeLike.Seconds === 'number') {
|
|
31
|
+
const output: Mtime = {
|
|
32
|
+
secs: BigInt(mtimeLike.Seconds)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (mtimeLike.FractionalNanoseconds != null) {
|
|
36
|
+
output.nsecs = mtimeLike.FractionalNanoseconds
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return output
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
throw new Error('Cannot convert object to mtime')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function dateToTimespec (date: Date): Mtime {
|
|
46
|
+
const ms = date.getTime()
|
|
47
|
+
const secs = Math.floor(ms / 1000)
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
secs: BigInt(secs),
|
|
51
|
+
nsecs: (ms - (secs * 1000)) * 1000
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isMtime (obj: any): obj is Mtime {
|
|
56
|
+
return typeof obj.secs === 'bigint'
|
|
57
|
+
}
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AlreadyExistsError": "https://ipfs.github.io/helia-unixfs/classes/errors.AlreadyExistsError.html",
|
|
3
|
-
"./errors:AlreadyExistsError": "https://ipfs.github.io/helia-unixfs/classes/errors.AlreadyExistsError.html",
|
|
4
|
-
"DoesNotExistError": "https://ipfs.github.io/helia-unixfs/classes/errors.DoesNotExistError.html",
|
|
5
|
-
"./errors:DoesNotExistError": "https://ipfs.github.io/helia-unixfs/classes/errors.DoesNotExistError.html",
|
|
6
|
-
"InvalidPBNodeError": "https://ipfs.github.io/helia-unixfs/classes/errors.InvalidPBNodeError.html",
|
|
7
|
-
"./errors:InvalidPBNodeError": "https://ipfs.github.io/helia-unixfs/classes/errors.InvalidPBNodeError.html",
|
|
8
|
-
"InvalidParametersError": "https://ipfs.github.io/helia-unixfs/classes/errors.InvalidParametersError.html",
|
|
9
|
-
"./errors:InvalidParametersError": "https://ipfs.github.io/helia-unixfs/classes/errors.InvalidParametersError.html",
|
|
10
|
-
"NoContentError": "https://ipfs.github.io/helia-unixfs/classes/errors.NoContentError.html",
|
|
11
|
-
"./errors:NoContentError": "https://ipfs.github.io/helia-unixfs/classes/errors.NoContentError.html",
|
|
12
|
-
"NotADirectoryError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotADirectoryError.html",
|
|
13
|
-
"./errors:NotADirectoryError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotADirectoryError.html",
|
|
14
|
-
"NotAFileError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotAFileError.html",
|
|
15
|
-
"./errors:NotAFileError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotAFileError.html",
|
|
16
|
-
"NotUnixFSError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotUnixFSError.html",
|
|
17
|
-
"./errors:NotUnixFSError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotUnixFSError.html",
|
|
18
|
-
"UnixFSError": "https://ipfs.github.io/helia-unixfs/classes/errors.UnixFSError.html",
|
|
19
|
-
"./errors:UnixFSError": "https://ipfs.github.io/helia-unixfs/classes/errors.UnixFSError.html",
|
|
20
|
-
"UnknownError": "https://ipfs.github.io/helia-unixfs/classes/errors.UnknownError.html",
|
|
21
|
-
"./errors:UnknownError": "https://ipfs.github.io/helia-unixfs/classes/errors.UnknownError.html",
|
|
22
|
-
"AddOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.AddOptions.html",
|
|
23
|
-
".:AddOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.AddOptions.html",
|
|
24
|
-
"CatOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.CatOptions.html",
|
|
25
|
-
".:CatOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.CatOptions.html",
|
|
26
|
-
"ChmodOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.ChmodOptions.html",
|
|
27
|
-
".:ChmodOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.ChmodOptions.html",
|
|
28
|
-
"CpOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.CpOptions.html",
|
|
29
|
-
".:CpOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.CpOptions.html",
|
|
30
|
-
"LsOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.LsOptions.html",
|
|
31
|
-
".:LsOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.LsOptions.html",
|
|
32
|
-
"MkdirOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.MkdirOptions.html",
|
|
33
|
-
".:MkdirOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.MkdirOptions.html",
|
|
34
|
-
"RmOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.RmOptions.html",
|
|
35
|
-
".:RmOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.RmOptions.html",
|
|
36
|
-
"StatOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.StatOptions.html",
|
|
37
|
-
".:StatOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.StatOptions.html",
|
|
38
|
-
"TouchOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.TouchOptions.html",
|
|
39
|
-
".:TouchOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.TouchOptions.html",
|
|
40
|
-
"UnixFS": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFS.html",
|
|
41
|
-
".:UnixFS": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFS.html",
|
|
42
|
-
"UnixFSComponents": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFSComponents.html",
|
|
43
|
-
".:UnixFSComponents": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFSComponents.html",
|
|
44
|
-
"UnixFSStats": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFSStats.html",
|
|
45
|
-
".:UnixFSStats": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFSStats.html",
|
|
46
|
-
"AddEvents": "https://ipfs.github.io/helia-unixfs/types/index.AddEvents.html",
|
|
47
|
-
".:AddEvents": "https://ipfs.github.io/helia-unixfs/types/index.AddEvents.html",
|
|
48
|
-
"GetEvents": "https://ipfs.github.io/helia-unixfs/types/index.GetEvents.html",
|
|
49
|
-
".:GetEvents": "https://ipfs.github.io/helia-unixfs/types/index.GetEvents.html",
|
|
50
|
-
"globSource": "https://ipfs.github.io/helia-unixfs/functions/index.globSource.html",
|
|
51
|
-
"unixfs": "https://ipfs.github.io/helia-unixfs/functions/index.unixfs-1.html",
|
|
52
|
-
".:unixfs": "https://ipfs.github.io/helia-unixfs/functions/index.unixfs-1.html",
|
|
53
|
-
"urlSource": "https://ipfs.github.io/helia-unixfs/functions/index.urlSource.html"
|
|
54
|
-
}
|