@helia/unixfs 1.2.2 → 1.2.4
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/dist/index.min.js +1 -1
- package/dist/src/commands/add.d.ts +2 -2
- package/dist/src/commands/add.d.ts.map +1 -1
- package/dist/src/commands/add.js +1 -1
- package/dist/src/commands/add.js.map +1 -1
- package/dist/src/commands/cat.d.ts +1 -1
- package/dist/src/commands/cat.d.ts.map +1 -1
- package/dist/src/commands/cat.js +2 -2
- package/dist/src/commands/cat.js.map +1 -1
- package/dist/src/commands/chmod.d.ts.map +1 -1
- package/dist/src/commands/chmod.js +12 -12
- package/dist/src/commands/chmod.js.map +1 -1
- package/dist/src/commands/cp.d.ts +1 -1
- package/dist/src/commands/cp.d.ts.map +1 -1
- package/dist/src/commands/cp.js +3 -3
- package/dist/src/commands/cp.js.map +1 -1
- package/dist/src/commands/ls.d.ts +2 -2
- package/dist/src/commands/ls.d.ts.map +1 -1
- package/dist/src/commands/ls.js +2 -2
- package/dist/src/commands/ls.js.map +1 -1
- package/dist/src/commands/mkdir.d.ts.map +1 -1
- package/dist/src/commands/mkdir.js +6 -6
- package/dist/src/commands/mkdir.js.map +1 -1
- package/dist/src/commands/rm.d.ts +1 -1
- package/dist/src/commands/rm.d.ts.map +1 -1
- package/dist/src/commands/rm.js +3 -3
- package/dist/src/commands/rm.js.map +1 -1
- package/dist/src/commands/stat.d.ts +1 -1
- package/dist/src/commands/stat.d.ts.map +1 -1
- package/dist/src/commands/stat.js +5 -5
- package/dist/src/commands/stat.js.map +1 -1
- package/dist/src/commands/touch.d.ts.map +1 -1
- package/dist/src/commands/touch.js +12 -12
- package/dist/src/commands/touch.js.map +1 -1
- package/dist/src/commands/utils/add-link.d.ts +3 -3
- package/dist/src/commands/utils/add-link.d.ts.map +1 -1
- package/dist/src/commands/utils/add-link.js +8 -8
- package/dist/src/commands/utils/add-link.js.map +1 -1
- package/dist/src/commands/utils/cid-to-directory.d.ts +3 -3
- package/dist/src/commands/utils/cid-to-directory.d.ts.map +1 -1
- package/dist/src/commands/utils/cid-to-directory.js +1 -1
- package/dist/src/commands/utils/cid-to-directory.js.map +1 -1
- package/dist/src/commands/utils/cid-to-pblink.d.ts +3 -3
- package/dist/src/commands/utils/cid-to-pblink.d.ts.map +1 -1
- package/dist/src/commands/utils/cid-to-pblink.js +2 -2
- package/dist/src/commands/utils/cid-to-pblink.js.map +1 -1
- package/dist/src/commands/utils/consumable-hash.js +9 -0
- package/dist/src/commands/utils/consumable-hash.js.map +1 -1
- package/dist/src/commands/utils/dir-sharded.d.ts +3 -3
- package/dist/src/commands/utils/dir-sharded.d.ts.map +1 -1
- package/dist/src/commands/utils/dir-sharded.js +19 -4
- package/dist/src/commands/utils/dir-sharded.js.map +1 -1
- package/dist/src/commands/utils/hamt-utils.d.ts +5 -5
- package/dist/src/commands/utils/hamt-utils.d.ts.map +1 -1
- package/dist/src/commands/utils/hamt-utils.js +5 -5
- package/dist/src/commands/utils/hamt-utils.js.map +1 -1
- package/dist/src/commands/utils/is-over-shard-threshold.d.ts +1 -1
- package/dist/src/commands/utils/is-over-shard-threshold.d.ts.map +1 -1
- package/dist/src/commands/utils/is-over-shard-threshold.js +1 -1
- package/dist/src/commands/utils/is-over-shard-threshold.js.map +1 -1
- package/dist/src/commands/utils/persist.d.ts +1 -1
- package/dist/src/commands/utils/persist.d.ts.map +1 -1
- package/dist/src/commands/utils/persist.js +1 -1
- package/dist/src/commands/utils/persist.js.map +1 -1
- package/dist/src/commands/utils/remove-link.d.ts +3 -3
- package/dist/src/commands/utils/remove-link.d.ts.map +1 -1
- package/dist/src/commands/utils/remove-link.js +6 -6
- package/dist/src/commands/utils/remove-link.js.map +1 -1
- package/dist/src/commands/utils/resolve.d.ts +2 -2
- package/dist/src/commands/utils/resolve.d.ts.map +1 -1
- package/dist/src/commands/utils/resolve.js +2 -2
- package/dist/src/commands/utils/resolve.js.map +1 -1
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/{commands/utils/errors.js → errors.js} +2 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -13
- package/dist/src/index.js.map +1 -1
- package/dist/typedoc-urls.json +25 -15
- package/package.json +23 -7
- package/src/commands/add.ts +4 -4
- package/src/commands/cat.ts +4 -4
- package/src/commands/chmod.ts +15 -15
- package/src/commands/cp.ts +6 -6
- package/src/commands/ls.ts +5 -5
- package/src/commands/mkdir.ts +8 -8
- package/src/commands/rm.ts +6 -6
- package/src/commands/stat.ts +9 -9
- package/src/commands/touch.ts +15 -15
- package/src/commands/utils/add-link.ts +14 -14
- package/src/commands/utils/cid-to-directory.ts +4 -4
- package/src/commands/utils/cid-to-pblink.ts +4 -4
- package/src/commands/utils/dir-sharded.ts +6 -6
- package/src/commands/utils/hamt-utils.ts +9 -9
- package/src/commands/utils/is-over-shard-threshold.ts +3 -3
- package/src/commands/utils/persist.ts +2 -2
- package/src/commands/utils/remove-link.ts +11 -11
- package/src/commands/utils/resolve.ts +4 -4
- package/src/index.ts +18 -18
- package/dist/src/commands/utils/errors.d.ts.map +0 -1
- package/dist/src/commands/utils/errors.js.map +0 -1
- /package/dist/src/{commands/utils/errors.d.ts → errors.d.ts} +0 -0
- /package/src/{commands/utils/errors.ts → errors.ts} +0 -0
package/dist/src/index.js
CHANGED
|
@@ -32,14 +32,15 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import { addAll, addBytes, addByteStream, addDirectory, addFile } from './commands/add.js';
|
|
34
34
|
import { cat } from './commands/cat.js';
|
|
35
|
-
import {
|
|
35
|
+
import { chmod } from './commands/chmod.js';
|
|
36
36
|
import { cp } from './commands/cp.js';
|
|
37
|
+
import { ls } from './commands/ls.js';
|
|
38
|
+
import { mkdir } from './commands/mkdir.js';
|
|
37
39
|
import { rm } from './commands/rm.js';
|
|
38
40
|
import { stat } from './commands/stat.js';
|
|
39
41
|
import { touch } from './commands/touch.js';
|
|
40
|
-
import { chmod } from './commands/chmod.js';
|
|
41
|
-
import { ls } from './commands/ls.js';
|
|
42
42
|
class DefaultUnixFS {
|
|
43
|
+
components;
|
|
43
44
|
constructor(components) {
|
|
44
45
|
this.components = components;
|
|
45
46
|
}
|
|
@@ -47,40 +48,40 @@ class DefaultUnixFS {
|
|
|
47
48
|
yield* addAll(source, this.components.blockstore, options);
|
|
48
49
|
}
|
|
49
50
|
async addBytes(bytes, options = {}) {
|
|
50
|
-
return
|
|
51
|
+
return addBytes(bytes, this.components.blockstore, options);
|
|
51
52
|
}
|
|
52
53
|
async addByteStream(bytes, options = {}) {
|
|
53
|
-
return
|
|
54
|
+
return addByteStream(bytes, this.components.blockstore, options);
|
|
54
55
|
}
|
|
55
56
|
async addFile(file, options = {}) {
|
|
56
|
-
return
|
|
57
|
+
return addFile(file, this.components.blockstore, options);
|
|
57
58
|
}
|
|
58
59
|
async addDirectory(dir = {}, options = {}) {
|
|
59
|
-
return
|
|
60
|
+
return addDirectory(dir, this.components.blockstore, options);
|
|
60
61
|
}
|
|
61
62
|
async *cat(cid, options = {}) {
|
|
62
63
|
yield* cat(cid, this.components.blockstore, options);
|
|
63
64
|
}
|
|
64
65
|
async chmod(cid, mode, options = {}) {
|
|
65
|
-
return
|
|
66
|
+
return chmod(cid, mode, this.components.blockstore, options);
|
|
66
67
|
}
|
|
67
68
|
async cp(source, target, name, options = {}) {
|
|
68
|
-
return
|
|
69
|
+
return cp(source, target, name, this.components.blockstore, options);
|
|
69
70
|
}
|
|
70
71
|
async *ls(cid, options = {}) {
|
|
71
72
|
yield* ls(cid, this.components.blockstore, options);
|
|
72
73
|
}
|
|
73
74
|
async mkdir(cid, dirname, options = {}) {
|
|
74
|
-
return
|
|
75
|
+
return mkdir(cid, dirname, this.components.blockstore, options);
|
|
75
76
|
}
|
|
76
77
|
async rm(cid, path, options = {}) {
|
|
77
|
-
return
|
|
78
|
+
return rm(cid, path, this.components.blockstore, options);
|
|
78
79
|
}
|
|
79
80
|
async stat(cid, options = {}) {
|
|
80
|
-
return
|
|
81
|
+
return stat(cid, this.components.blockstore, options);
|
|
81
82
|
}
|
|
82
83
|
async touch(cid, options = {}) {
|
|
83
|
-
return
|
|
84
|
+
return touch(cid, this.components.blockstore, options);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
/**
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC1F,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAsc3C,MAAM,aAAa;IACA,UAAU,CAAkB;IAE7C,YAAa,UAA4B;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,CAAE,MAAM,CAAE,MAA6B,EAAE,UAA+B,EAAE;QAC9E,KAAM,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC7D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAE,KAAiB,EAAE,UAA+B,EAAE;QAClE,OAAO,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC7D,CAAC;IAED,KAAK,CAAC,aAAa,CAAE,KAAiB,EAAE,UAA+B,EAAE;QACvE,OAAO,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAClE,CAAC;IAED,KAAK,CAAC,OAAO,CAAE,IAAmB,EAAE,UAA+B,EAAE;QACnE,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,YAAY,CAAE,MAAmC,EAAE,EAAE,UAA+B,EAAE;QAC1F,OAAO,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC;IAED,KAAK,CAAC,CAAE,GAAG,CAAE,GAAQ,EAAE,UAA+B,EAAE;QACtD,KAAM,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IAED,KAAK,CAAC,KAAK,CAAE,GAAQ,EAAE,IAAY,EAAE,UAAiC,EAAE;QACtE,OAAO,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,EAAE,CAAE,MAAW,EAAE,MAAW,EAAE,IAAY,EAAE,UAA8B,EAAE;QAChF,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAED,KAAK,CAAC,CAAE,EAAE,CAAE,GAAQ,EAAE,UAA8B,EAAE;QACpD,KAAM,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC;IAED,KAAK,CAAC,KAAK,CAAE,GAAQ,EAAE,OAAe,EAAE,UAAiC,EAAE;QACzE,OAAO,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACjE,CAAC;IAED,KAAK,CAAC,EAAE,CAAE,GAAQ,EAAE,IAAY,EAAE,UAA8B,EAAE;QAChE,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,IAAI,CAAE,GAAQ,EAAE,UAAgC,EAAE;QACtD,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IAED,KAAK,CAAC,KAAK,CAAE,GAAQ,EAAE,UAAiC,EAAE;QACxD,OAAO,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAE,KAA6B;IACnD,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC"}
|
package/dist/typedoc-urls.json
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
2
|
+
"AlreadyExistsError": "https://ipfs.github.io/helia-unixfs/classes/errors.AlreadyExistsError.html",
|
|
3
|
+
"DoesNotExistError": "https://ipfs.github.io/helia-unixfs/classes/errors.DoesNotExistError.html",
|
|
4
|
+
"InvalidPBNodeError": "https://ipfs.github.io/helia-unixfs/classes/errors.InvalidPBNodeError.html",
|
|
5
|
+
"InvalidParametersError": "https://ipfs.github.io/helia-unixfs/classes/errors.InvalidParametersError.html",
|
|
6
|
+
"NoContentError": "https://ipfs.github.io/helia-unixfs/classes/errors.NoContentError.html",
|
|
7
|
+
"NotADirectoryError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotADirectoryError.html",
|
|
8
|
+
"NotAFileError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotAFileError.html",
|
|
9
|
+
"NotUnixFSError": "https://ipfs.github.io/helia-unixfs/classes/errors.NotUnixFSError.html",
|
|
10
|
+
"UnixFSError": "https://ipfs.github.io/helia-unixfs/classes/errors.UnixFSError.html",
|
|
11
|
+
"UnknownError": "https://ipfs.github.io/helia-unixfs/classes/errors.UnknownError.html",
|
|
12
|
+
"AddOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.AddOptions.html",
|
|
13
|
+
"CatOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.CatOptions.html",
|
|
14
|
+
"ChmodOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.ChmodOptions.html",
|
|
15
|
+
"CpOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.CpOptions.html",
|
|
16
|
+
"LsOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.LsOptions.html",
|
|
17
|
+
"MkdirOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.MkdirOptions.html",
|
|
18
|
+
"RmOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.RmOptions.html",
|
|
19
|
+
"StatOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.StatOptions.html",
|
|
20
|
+
"TouchOptions": "https://ipfs.github.io/helia-unixfs/interfaces/index.TouchOptions.html",
|
|
21
|
+
"UnixFS": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFS.html",
|
|
22
|
+
"UnixFSComponents": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFSComponents.html",
|
|
23
|
+
"UnixFSStats": "https://ipfs.github.io/helia-unixfs/interfaces/index.UnixFSStats.html",
|
|
24
|
+
"AddEvents": "https://ipfs.github.io/helia-unixfs/types/index.AddEvents.html",
|
|
25
|
+
"GetEvents": "https://ipfs.github.io/helia-unixfs/types/index.GetEvents.html",
|
|
26
|
+
"unixfs": "https://ipfs.github.io/helia-unixfs/functions/index.unixfs-1.html"
|
|
17
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/unixfs",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "A Helia-compatible wrapper for UnixFS",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia-unixfs/tree/master/packages/unixfs#readme",
|
|
@@ -14,12 +14,24 @@
|
|
|
14
14
|
"keywords": [
|
|
15
15
|
"IPFS"
|
|
16
16
|
],
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=16.0.0",
|
|
19
|
-
"npm": ">=7.0.0"
|
|
20
|
-
},
|
|
21
17
|
"type": "module",
|
|
22
18
|
"types": "./dist/src/index.d.ts",
|
|
19
|
+
"typesVersions": {
|
|
20
|
+
"*": {
|
|
21
|
+
"*": [
|
|
22
|
+
"*",
|
|
23
|
+
"dist/*",
|
|
24
|
+
"dist/src/*",
|
|
25
|
+
"dist/src/*/index"
|
|
26
|
+
],
|
|
27
|
+
"src/*": [
|
|
28
|
+
"*",
|
|
29
|
+
"dist/*",
|
|
30
|
+
"dist/src/*",
|
|
31
|
+
"dist/src/*/index"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
23
35
|
"files": [
|
|
24
36
|
"src",
|
|
25
37
|
"dist",
|
|
@@ -30,6 +42,10 @@
|
|
|
30
42
|
".": {
|
|
31
43
|
"types": "./dist/src/index.d.ts",
|
|
32
44
|
"import": "./dist/src/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./errors": {
|
|
47
|
+
"types": "./dist/src/errors.d.ts",
|
|
48
|
+
"import": "./dist/src/errors.js"
|
|
33
49
|
}
|
|
34
50
|
},
|
|
35
51
|
"eslintConfig": {
|
|
@@ -157,9 +173,9 @@
|
|
|
157
173
|
"sparse-array": "^1.3.2"
|
|
158
174
|
},
|
|
159
175
|
"devDependencies": {
|
|
160
|
-
"aegir": "^
|
|
176
|
+
"aegir": "^39.0.8",
|
|
161
177
|
"blockstore-core": "^4.0.1",
|
|
162
|
-
"delay": "^
|
|
178
|
+
"delay": "^6.0.0",
|
|
163
179
|
"it-all": "^3.0.1",
|
|
164
180
|
"it-drain": "^3.0.1",
|
|
165
181
|
"it-first": "^3.0.1",
|
package/src/commands/add.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Blocks } from '@helia/interface/blocks'
|
|
3
|
-
import { ByteStream, DirectoryCandidate, FileCandidate, importBytes, importByteStream, ImportCandidateStream, importDirectory, importer, ImporterOptions, importFile, ImportResult } from 'ipfs-unixfs-importer'
|
|
4
|
-
import { balanced } from 'ipfs-unixfs-importer/layout'
|
|
1
|
+
import { type ByteStream, type DirectoryCandidate, type FileCandidate, importBytes, importByteStream, type ImportCandidateStream, importDirectory, importer, type ImporterOptions, importFile, type ImportResult } from 'ipfs-unixfs-importer'
|
|
5
2
|
import { fixedSize } from 'ipfs-unixfs-importer/chunker'
|
|
3
|
+
import { balanced } from 'ipfs-unixfs-importer/layout'
|
|
4
|
+
import type { Blocks } from '@helia/interface/blocks'
|
|
5
|
+
import type { CID } from 'multiformats/cid'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Default importer settings match Filecoin
|
package/src/commands/cat.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { exporter } from 'ipfs-unixfs-exporter'
|
|
2
|
-
import type { CID } from 'multiformats/cid'
|
|
3
|
-
import type { CatOptions } from '../index.js'
|
|
4
|
-
import { resolve } from './utils/resolve.js'
|
|
5
2
|
import mergeOpts from 'merge-options'
|
|
3
|
+
import { NoContentError, NotAFileError } from '../errors.js'
|
|
4
|
+
import { resolve } from './utils/resolve.js'
|
|
5
|
+
import type { CatOptions } from '../index.js'
|
|
6
6
|
import type { Blocks } from '@helia/interface/blocks'
|
|
7
|
-
import {
|
|
7
|
+
import type { CID } from 'multiformats/cid'
|
|
8
8
|
|
|
9
9
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
10
10
|
|
package/src/commands/chmod.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CID } from 'multiformats/cid'
|
|
3
|
-
import type { ChmodOptions } from '../index.js'
|
|
4
|
-
import mergeOpts from 'merge-options'
|
|
1
|
+
import * as dagPB from '@ipld/dag-pb'
|
|
5
2
|
import { logger } from '@libp2p/logger'
|
|
6
3
|
import { UnixFS } from 'ipfs-unixfs'
|
|
7
|
-
import {
|
|
8
|
-
import { InvalidPBNodeError, NotUnixFSError, UnknownError } from './utils/errors.js'
|
|
9
|
-
import * as dagPB from '@ipld/dag-pb'
|
|
10
|
-
import type { PBNode, PBLink } from '@ipld/dag-pb'
|
|
4
|
+
import { recursive } from 'ipfs-unixfs-exporter'
|
|
11
5
|
import { importer } from 'ipfs-unixfs-importer'
|
|
12
|
-
import { persist } from './utils/persist.js'
|
|
13
|
-
import type { Blocks } from '@helia/interface/blocks'
|
|
14
6
|
import last from 'it-last'
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
7
|
+
import { pipe } from 'it-pipe'
|
|
8
|
+
import mergeOpts from 'merge-options'
|
|
9
|
+
import { CID } from 'multiformats/cid'
|
|
17
10
|
import * as raw from 'multiformats/codecs/raw'
|
|
11
|
+
import { sha256 } from 'multiformats/hashes/sha2'
|
|
12
|
+
import { InvalidPBNodeError, NotUnixFSError, UnknownError } from '../errors.js'
|
|
18
13
|
import { SHARD_SPLIT_THRESHOLD_BYTES } from './utils/constants.js'
|
|
14
|
+
import { persist } from './utils/persist.js'
|
|
15
|
+
import { resolve, updatePathCids } from './utils/resolve.js'
|
|
16
|
+
import type { ChmodOptions } from '../index.js'
|
|
17
|
+
import type { Blocks } from '@helia/interface/blocks'
|
|
18
|
+
import type { PBNode, PBLink } from '@ipld/dag-pb'
|
|
19
19
|
|
|
20
20
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
21
21
|
const log = logger('helia:unixfs:chmod')
|
|
@@ -94,14 +94,14 @@ export async function chmod (cid: CID, mode: number, blockstore: Blocks, options
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}),
|
|
97
|
-
async (nodes) =>
|
|
97
|
+
async (nodes) => last(nodes)
|
|
98
98
|
)
|
|
99
99
|
|
|
100
100
|
if (root == null) {
|
|
101
101
|
throw new UnknownError(`Could not chmod ${resolved.cid.toString()}`)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
return
|
|
104
|
+
return updatePathCids(root.cid, resolved, blockstore, opts)
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const block = await blockstore.get(resolved.cid)
|
|
@@ -133,5 +133,5 @@ export async function chmod (cid: CID, mode: number, blockstore: Blocks, options
|
|
|
133
133
|
|
|
134
134
|
await blockstore.put(updatedCid, updatedBlock)
|
|
135
135
|
|
|
136
|
-
return
|
|
136
|
+
return updatePathCids(updatedCid, resolved, blockstore, opts)
|
|
137
137
|
}
|
package/src/commands/cp.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { Blocks } from '@helia/interface/blocks'
|
|
2
|
-
import type { CID } from 'multiformats/cid'
|
|
3
|
-
import type { CpOptions } from '../index.js'
|
|
4
|
-
import mergeOpts from 'merge-options'
|
|
5
1
|
import { logger } from '@libp2p/logger'
|
|
2
|
+
import mergeOpts from 'merge-options'
|
|
3
|
+
import { InvalidParametersError } from '../errors.js'
|
|
6
4
|
import { addLink } from './utils/add-link.js'
|
|
7
|
-
import { cidToPBLink } from './utils/cid-to-pblink.js'
|
|
8
5
|
import { cidToDirectory } from './utils/cid-to-directory.js'
|
|
6
|
+
import { cidToPBLink } from './utils/cid-to-pblink.js'
|
|
9
7
|
import { SHARD_SPLIT_THRESHOLD_BYTES } from './utils/constants.js'
|
|
10
|
-
import {
|
|
8
|
+
import type { CpOptions } from '../index.js'
|
|
9
|
+
import type { Blocks } from '@helia/interface/blocks'
|
|
10
|
+
import type { CID } from 'multiformats/cid'
|
|
11
11
|
|
|
12
12
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
13
13
|
const log = logger('helia:unixfs:cp')
|
package/src/commands/ls.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { exporter, UnixFSEntry } from 'ipfs-unixfs-exporter'
|
|
2
|
-
import type { CID } from 'multiformats/cid'
|
|
3
|
-
import type { LsOptions } from '../index.js'
|
|
4
|
-
import { resolve } from './utils/resolve.js'
|
|
1
|
+
import { exporter, type UnixFSEntry } from 'ipfs-unixfs-exporter'
|
|
5
2
|
import mergeOpts from 'merge-options'
|
|
3
|
+
import { NoContentError, NotADirectoryError } from '../errors.js'
|
|
4
|
+
import { resolve } from './utils/resolve.js'
|
|
5
|
+
import type { LsOptions } from '../index.js'
|
|
6
6
|
import type { Blocks } from '@helia/interface/blocks'
|
|
7
|
-
import {
|
|
7
|
+
import type { CID } from 'multiformats/cid'
|
|
8
8
|
|
|
9
9
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
10
10
|
|
package/src/commands/mkdir.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { CID } from 'multiformats/cid'
|
|
2
|
-
import mergeOpts from 'merge-options'
|
|
3
|
-
import { logger } from '@libp2p/logger'
|
|
4
|
-
import type { MkdirOptions } from '../index.js'
|
|
5
1
|
import * as dagPB from '@ipld/dag-pb'
|
|
6
|
-
import {
|
|
7
|
-
import type { Blocks } from '@helia/interface/blocks'
|
|
2
|
+
import { logger } from '@libp2p/logger'
|
|
8
3
|
import { UnixFS } from 'ipfs-unixfs'
|
|
9
|
-
import { sha256 } from 'multiformats/hashes/sha2'
|
|
10
4
|
import { exporter } from 'ipfs-unixfs-exporter'
|
|
5
|
+
import mergeOpts from 'merge-options'
|
|
6
|
+
import { CID } from 'multiformats/cid'
|
|
7
|
+
import { sha256 } from 'multiformats/hashes/sha2'
|
|
8
|
+
import { InvalidParametersError, NotADirectoryError } from '../errors.js'
|
|
9
|
+
import { addLink } from './utils/add-link.js'
|
|
11
10
|
import { cidToDirectory } from './utils/cid-to-directory.js'
|
|
12
11
|
import { cidToPBLink } from './utils/cid-to-pblink.js'
|
|
13
12
|
import { SHARD_SPLIT_THRESHOLD_BYTES } from './utils/constants.js'
|
|
14
|
-
import {
|
|
13
|
+
import type { MkdirOptions } from '../index.js'
|
|
14
|
+
import type { Blocks } from '@helia/interface/blocks'
|
|
15
15
|
|
|
16
16
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
17
17
|
const log = logger('helia:unixfs:mkdir')
|
package/src/commands/rm.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Blocks } from '@helia/interface/blocks'
|
|
2
|
-
import type { CID } from 'multiformats/cid'
|
|
3
|
-
import type { RmOptions } from '../index.js'
|
|
4
|
-
import mergeOpts from 'merge-options'
|
|
5
1
|
import { logger } from '@libp2p/logger'
|
|
6
|
-
import
|
|
2
|
+
import mergeOpts from 'merge-options'
|
|
3
|
+
import { InvalidParametersError } from '../errors.js'
|
|
7
4
|
import { cidToDirectory } from './utils/cid-to-directory.js'
|
|
8
5
|
import { SHARD_SPLIT_THRESHOLD_BYTES } from './utils/constants.js'
|
|
9
|
-
import {
|
|
6
|
+
import { removeLink } from './utils/remove-link.js'
|
|
7
|
+
import type { RmOptions } from '../index.js'
|
|
8
|
+
import type { Blocks } from '@helia/interface/blocks'
|
|
9
|
+
import type { CID } from 'multiformats/cid'
|
|
10
10
|
|
|
11
11
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
12
12
|
const log = logger('helia:unixfs:rm')
|
package/src/commands/stat.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { CID } from 'multiformats/cid'
|
|
3
|
-
import type { StatOptions, UnixFSStats } from '../index.js'
|
|
4
|
-
import mergeOpts from 'merge-options'
|
|
1
|
+
import * as dagPb from '@ipld/dag-pb'
|
|
5
2
|
import { logger } from '@libp2p/logger'
|
|
6
3
|
import { UnixFS } from 'ipfs-unixfs'
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import type { AbortOptions } from '@libp2p/interfaces'
|
|
10
|
-
import type { Mtime } from 'ipfs-unixfs'
|
|
11
|
-
import { resolve } from './utils/resolve.js'
|
|
4
|
+
import { exporter } from 'ipfs-unixfs-exporter'
|
|
5
|
+
import mergeOpts from 'merge-options'
|
|
12
6
|
import * as raw from 'multiformats/codecs/raw'
|
|
7
|
+
import { InvalidPBNodeError, NotUnixFSError, UnknownError } from '../errors.js'
|
|
8
|
+
import { resolve } from './utils/resolve.js'
|
|
9
|
+
import type { StatOptions, UnixFSStats } from '../index.js'
|
|
13
10
|
import type { Blocks } from '@helia/interface/blocks'
|
|
11
|
+
import type { AbortOptions } from '@libp2p/interfaces'
|
|
12
|
+
import type { Mtime } from 'ipfs-unixfs'
|
|
13
|
+
import type { CID } from 'multiformats/cid'
|
|
14
14
|
|
|
15
15
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
16
16
|
const log = logger('helia:unixfs:stat')
|
package/src/commands/touch.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CID } from 'multiformats/cid'
|
|
3
|
-
import type { TouchOptions } from '../index.js'
|
|
4
|
-
import mergeOpts from 'merge-options'
|
|
1
|
+
import * as dagPB from '@ipld/dag-pb'
|
|
5
2
|
import { logger } from '@libp2p/logger'
|
|
6
3
|
import { UnixFS } from 'ipfs-unixfs'
|
|
7
|
-
import {
|
|
8
|
-
import { InvalidPBNodeError, NotUnixFSError, UnknownError } from './utils/errors.js'
|
|
9
|
-
import * as dagPB from '@ipld/dag-pb'
|
|
10
|
-
import type { PBNode, PBLink } from '@ipld/dag-pb'
|
|
4
|
+
import { recursive } from 'ipfs-unixfs-exporter'
|
|
11
5
|
import { importer } from 'ipfs-unixfs-importer'
|
|
12
|
-
import { persist } from './utils/persist.js'
|
|
13
|
-
import type { Blocks } from '@helia/interface/blocks'
|
|
14
6
|
import last from 'it-last'
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
7
|
+
import { pipe } from 'it-pipe'
|
|
8
|
+
import mergeOpts from 'merge-options'
|
|
9
|
+
import { CID } from 'multiformats/cid'
|
|
17
10
|
import * as raw from 'multiformats/codecs/raw'
|
|
11
|
+
import { sha256 } from 'multiformats/hashes/sha2'
|
|
12
|
+
import { InvalidPBNodeError, NotUnixFSError, UnknownError } from '../errors.js'
|
|
18
13
|
import { SHARD_SPLIT_THRESHOLD_BYTES } from './utils/constants.js'
|
|
14
|
+
import { persist } from './utils/persist.js'
|
|
15
|
+
import { resolve, updatePathCids } from './utils/resolve.js'
|
|
16
|
+
import type { TouchOptions } from '../index.js'
|
|
17
|
+
import type { Blocks } from '@helia/interface/blocks'
|
|
18
|
+
import type { PBNode, PBLink } from '@ipld/dag-pb'
|
|
19
19
|
|
|
20
20
|
const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
|
|
21
21
|
const log = logger('helia:unixfs:touch')
|
|
@@ -98,14 +98,14 @@ export async function touch (cid: CID, blockstore: Blocks, options: Partial<Touc
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}),
|
|
101
|
-
async (nodes) =>
|
|
101
|
+
async (nodes) => last(nodes)
|
|
102
102
|
)
|
|
103
103
|
|
|
104
104
|
if (root == null) {
|
|
105
105
|
throw new UnknownError(`Could not chmod ${resolved.cid.toString()}`)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
return
|
|
108
|
+
return updatePathCids(root.cid, resolved, blockstore, opts)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const block = await blockstore.get(resolved.cid)
|
|
@@ -136,5 +136,5 @@ export async function touch (cid: CID, blockstore: Blocks, options: Partial<Touc
|
|
|
136
136
|
|
|
137
137
|
await blockstore.put(updatedCid, updatedBlock)
|
|
138
138
|
|
|
139
|
-
return
|
|
139
|
+
return updatePathCids(updatedCid, resolved, blockstore, opts)
|
|
140
140
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import * as dagPB from '@ipld/dag-pb'
|
|
2
|
-
import { CID, Version } from 'multiformats/cid'
|
|
3
2
|
import { logger } from '@libp2p/logger'
|
|
4
3
|
import { UnixFS } from 'ipfs-unixfs'
|
|
4
|
+
import { CID, type Version } from 'multiformats/cid'
|
|
5
|
+
import { sha256 } from 'multiformats/hashes/sha2'
|
|
6
|
+
// @ts-expect-error no types
|
|
7
|
+
import SparseArray from 'sparse-array'
|
|
8
|
+
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
9
|
+
import { AlreadyExistsError, InvalidParametersError, InvalidPBNodeError } from '../../errors.js'
|
|
10
|
+
import { wrapHash } from './consumable-hash.js'
|
|
11
|
+
import { hamtBucketBits, hamtHashFn } from './hamt-constants.js'
|
|
5
12
|
import {
|
|
6
13
|
createShard,
|
|
7
14
|
recreateShardedDirectory,
|
|
8
15
|
toPrefix,
|
|
9
16
|
updateShardedDirectory
|
|
10
17
|
} from './hamt-utils.js'
|
|
11
|
-
import
|
|
12
|
-
import { sha256 } from 'multiformats/hashes/sha2'
|
|
13
|
-
import { AlreadyExistsError, InvalidParametersError, InvalidPBNodeError } from './errors.js'
|
|
14
|
-
import type { ImportResult } from 'ipfs-unixfs-importer'
|
|
15
|
-
import type { AbortOptions } from '@libp2p/interfaces'
|
|
18
|
+
import { isOverShardThreshold } from './is-over-shard-threshold.js'
|
|
16
19
|
import type { Directory } from './cid-to-directory.js'
|
|
17
20
|
import type { Blocks } from '@helia/interface/blocks'
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
import SparseArray from 'sparse-array'
|
|
22
|
-
import { wrapHash } from './consumable-hash.js'
|
|
23
|
-
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
21
|
+
import type { PBNode, PBLink } from '@ipld/dag-pb/interface'
|
|
22
|
+
import type { AbortOptions } from '@libp2p/interfaces'
|
|
23
|
+
import type { ImportResult } from 'ipfs-unixfs-importer'
|
|
24
24
|
|
|
25
25
|
const log = logger('helia:unixfs:components:utils:add-link')
|
|
26
26
|
|
|
@@ -45,7 +45,7 @@ export async function addLink (parent: Directory, child: Required<PBLink>, block
|
|
|
45
45
|
if (meta.type === 'hamt-sharded-directory') {
|
|
46
46
|
log('adding link to sharded directory')
|
|
47
47
|
|
|
48
|
-
return
|
|
48
|
+
return addToShardedDirectory(parent, child, blockstore, options)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
log(`adding ${child.Name} (${child.Hash}) to regular directory`)
|
|
@@ -253,5 +253,5 @@ const addToShardedDirectory = async (parent: Directory, child: Required<PBLink>,
|
|
|
253
253
|
log('adding %s to existing sub-shard', linkName)
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
return
|
|
256
|
+
return updateShardedDirectory(path, blockstore, options)
|
|
257
257
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { exporter, ExporterOptions } from 'ipfs-unixfs-exporter'
|
|
2
|
-
import
|
|
3
|
-
import type { PBNode } from '@ipld/dag-pb'
|
|
1
|
+
import { exporter, type ExporterOptions } from 'ipfs-unixfs-exporter'
|
|
2
|
+
import { NotADirectoryError } from '../../errors.js'
|
|
4
3
|
import type { Blocks } from '@helia/interface/blocks'
|
|
5
|
-
import {
|
|
4
|
+
import type { PBNode } from '@ipld/dag-pb'
|
|
5
|
+
import type { CID } from 'multiformats/cid'
|
|
6
6
|
|
|
7
7
|
export interface Directory {
|
|
8
8
|
cid: CID
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { exporter, ExporterOptions } from 'ipfs-unixfs-exporter'
|
|
2
|
-
import type { CID } from 'multiformats/cid'
|
|
3
|
-
import { NotUnixFSError } from './errors.js'
|
|
4
1
|
import * as dagPb from '@ipld/dag-pb'
|
|
5
|
-
import
|
|
2
|
+
import { exporter, type ExporterOptions } from 'ipfs-unixfs-exporter'
|
|
3
|
+
import { NotUnixFSError } from '../../errors.js'
|
|
6
4
|
import type { Blocks } from '@helia/interface/blocks'
|
|
5
|
+
import type { PBNode, PBLink } from '@ipld/dag-pb'
|
|
6
|
+
import type { CID } from 'multiformats/cid'
|
|
7
7
|
|
|
8
8
|
export async function cidToPBLink (cid: CID, name: string, blockstore: Blocks, options?: ExporterOptions): Promise<Required<PBLink>> {
|
|
9
9
|
const sourceEntry = await exporter(cid, blockstore, options)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { encode, PBLink, prepare } from '@ipld/dag-pb'
|
|
1
|
+
import { encode, type PBLink, prepare } from '@ipld/dag-pb'
|
|
2
|
+
import { createHAMT, Bucket, type BucketChild } from 'hamt-sharding'
|
|
2
3
|
import { UnixFS } from 'ipfs-unixfs'
|
|
3
|
-
import {
|
|
4
|
-
import { createHAMT, Bucket, BucketChild } from 'hamt-sharding'
|
|
4
|
+
import { CID } from 'multiformats/cid'
|
|
5
5
|
import {
|
|
6
6
|
hamtHashCode,
|
|
7
7
|
hamtHashFn
|
|
8
8
|
} from './hamt-constants.js'
|
|
9
|
-
import {
|
|
10
|
-
import type { Mtime } from 'ipfs-unixfs'
|
|
9
|
+
import { persist, type PersistOptions } from './persist.js'
|
|
11
10
|
import type { Blocks } from '@helia/interface/blocks'
|
|
11
|
+
import type { Mtime } from 'ipfs-unixfs'
|
|
12
12
|
|
|
13
13
|
interface InProgressImportResult extends ImportResult {
|
|
14
14
|
single?: boolean
|
|
@@ -95,7 +95,7 @@ export class DirSharded extends Dir {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
async get (name: string): Promise<InProgressImportResult | Dir | undefined> {
|
|
98
|
-
return
|
|
98
|
+
return this._bucket.get(name)
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
childCount (): number {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import * as dagPB from '@ipld/dag-pb'
|
|
2
|
-
import { DirSharded } from './dir-sharded.js'
|
|
3
2
|
import { logger } from '@libp2p/logger'
|
|
4
3
|
import { UnixFS } from 'ipfs-unixfs'
|
|
5
4
|
import last from 'it-last'
|
|
6
|
-
|
|
5
|
+
// @ts-expect-error no types
|
|
6
|
+
import SparseArray from 'sparse-array'
|
|
7
|
+
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
8
|
+
import { type InfiniteHash, wrapHash } from './consumable-hash.js'
|
|
9
|
+
import { DirSharded } from './dir-sharded.js'
|
|
7
10
|
import {
|
|
8
11
|
hamtHashCode,
|
|
9
12
|
hamtHashFn,
|
|
10
13
|
hamtBucketBits
|
|
11
14
|
} from './hamt-constants.js'
|
|
15
|
+
import { persist } from './persist.js'
|
|
16
|
+
import type { PersistOptions } from './persist.js'
|
|
12
17
|
import type { Blocks } from '@helia/interface/blocks'
|
|
13
|
-
import type { Mtime } from 'ipfs-unixfs'
|
|
14
18
|
import type { AbortOptions } from '@libp2p/interfaces'
|
|
19
|
+
import type { Mtime } from 'ipfs-unixfs'
|
|
15
20
|
import type { ImportResult } from 'ipfs-unixfs-importer'
|
|
16
|
-
import {
|
|
17
|
-
import { InfiniteHash, wrapHash } from './consumable-hash.js'
|
|
18
|
-
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
19
|
-
// @ts-expect-error no types
|
|
20
|
-
import SparseArray from 'sparse-array'
|
|
21
|
-
import type { PersistOptions } from './persist.js'
|
|
21
|
+
import type { CID, Version } from 'multiformats/cid'
|
|
22
22
|
|
|
23
23
|
const log = logger('helia:unixfs:commands:utils:hamt-utils')
|
|
24
24
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PBNode } from '@ipld/dag-pb'
|
|
2
|
-
import type { Blocks } from '@helia/interface/blocks'
|
|
3
|
-
import { UnixFS } from 'ipfs-unixfs'
|
|
4
1
|
import * as dagPb from '@ipld/dag-pb'
|
|
2
|
+
import { UnixFS } from 'ipfs-unixfs'
|
|
5
3
|
import { CID_V0, CID_V1 } from './dir-sharded.js'
|
|
4
|
+
import type { Blocks } from '@helia/interface/blocks'
|
|
5
|
+
import type { PBNode } from '@ipld/dag-pb'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Estimate node size only based on DAGLink name and CID byte lengths
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CID } from 'multiformats/cid'
|
|
2
1
|
import * as dagPb from '@ipld/dag-pb'
|
|
2
|
+
import { CID } from 'multiformats/cid'
|
|
3
3
|
import { sha256 } from 'multiformats/hashes/sha2'
|
|
4
4
|
import type { Blocks } from '@helia/interface/blocks'
|
|
5
|
-
import type { BlockCodec } from 'multiformats/codecs/interface'
|
|
6
5
|
import type { Version as CIDVersion } from 'multiformats/cid'
|
|
6
|
+
import type { BlockCodec } from 'multiformats/codecs/interface'
|
|
7
7
|
|
|
8
8
|
export interface PersistOptions {
|
|
9
9
|
codec?: BlockCodec<any, any>
|