@helia/unixfs 1.2.1 → 1.2.3
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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +5 -5
- 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 +2 -2
- 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 +4 -4
- 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.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 +1 -1
- 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/errors.js +2 -0
- package/dist/src/commands/utils/errors.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/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/package.json +9 -9
- 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 +5 -5
- package/src/commands/ls.ts +5 -5
- package/src/commands/mkdir.ts +7 -7
- package/src/commands/rm.ts +5 -5
- package/src/commands/stat.ts +8 -8
- 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/src/index.ts
CHANGED
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
import type { CID, Version } from 'multiformats/cid'
|
|
35
|
-
import type { Blocks, GetBlockProgressEvents, PutBlockProgressEvents } from '@helia/interface/blocks'
|
|
36
|
-
import type { AbortOptions } from '@libp2p/interfaces'
|
|
37
34
|
import { addAll, addBytes, addByteStream, addDirectory, addFile } from './commands/add.js'
|
|
38
35
|
import { cat } from './commands/cat.js'
|
|
39
|
-
import {
|
|
40
|
-
import type { Mtime } from 'ipfs-unixfs'
|
|
36
|
+
import { chmod } from './commands/chmod.js'
|
|
41
37
|
import { cp } from './commands/cp.js'
|
|
38
|
+
import { ls } from './commands/ls.js'
|
|
39
|
+
import { mkdir } from './commands/mkdir.js'
|
|
42
40
|
import { rm } from './commands/rm.js'
|
|
43
41
|
import { stat } from './commands/stat.js'
|
|
44
42
|
import { touch } from './commands/touch.js'
|
|
45
|
-
import {
|
|
43
|
+
import type { Blocks, GetBlockProgressEvents, PutBlockProgressEvents } from '@helia/interface/blocks'
|
|
44
|
+
import type { AbortOptions } from '@libp2p/interfaces'
|
|
45
|
+
import type { Mtime, UnixFS as IPFSUnixFS } from 'ipfs-unixfs'
|
|
46
46
|
import type { ExporterProgressEvents, UnixFSEntry } from 'ipfs-unixfs-exporter'
|
|
47
|
-
import { ls } from './commands/ls.js'
|
|
48
47
|
import type { ByteStream, DirectoryCandidate, FileCandidate, ImportCandidateStream, ImporterOptions, ImporterProgressEvents, ImportResult } from 'ipfs-unixfs-importer'
|
|
48
|
+
import type { CID, Version } from 'multiformats/cid'
|
|
49
49
|
import type { ProgressOptions } from 'progress-events'
|
|
50
50
|
|
|
51
51
|
export interface UnixFSComponents {
|
|
@@ -248,7 +248,7 @@ export interface UnixFSStats {
|
|
|
248
248
|
* UnixFS metadata about this file or directory. Will not be present
|
|
249
249
|
* if the node is a `raw` type.
|
|
250
250
|
*/
|
|
251
|
-
unixfs?:
|
|
251
|
+
unixfs?: IPFSUnixFS
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
/**
|
|
@@ -505,19 +505,19 @@ class DefaultUnixFS implements UnixFS {
|
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
async addBytes (bytes: Uint8Array, options: Partial<AddOptions> = {}): Promise<CID> {
|
|
508
|
-
return
|
|
508
|
+
return addBytes(bytes, this.components.blockstore, options)
|
|
509
509
|
}
|
|
510
510
|
|
|
511
511
|
async addByteStream (bytes: ByteStream, options: Partial<AddOptions> = {}): Promise<CID> {
|
|
512
|
-
return
|
|
512
|
+
return addByteStream(bytes, this.components.blockstore, options)
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
async addFile (file: FileCandidate, options: Partial<AddOptions> = {}): Promise<CID> {
|
|
516
|
-
return
|
|
516
|
+
return addFile(file, this.components.blockstore, options)
|
|
517
517
|
}
|
|
518
518
|
|
|
519
519
|
async addDirectory (dir: Partial<DirectoryCandidate> = {}, options: Partial<AddOptions> = {}): Promise<CID> {
|
|
520
|
-
return
|
|
520
|
+
return addDirectory(dir, this.components.blockstore, options)
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
async * cat (cid: CID, options: Partial<CatOptions> = {}): AsyncIterable<Uint8Array> {
|
|
@@ -525,11 +525,11 @@ class DefaultUnixFS implements UnixFS {
|
|
|
525
525
|
}
|
|
526
526
|
|
|
527
527
|
async chmod (cid: CID, mode: number, options: Partial<ChmodOptions> = {}): Promise<CID> {
|
|
528
|
-
return
|
|
528
|
+
return chmod(cid, mode, this.components.blockstore, options)
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
async cp (source: CID, target: CID, name: string, options: Partial<CpOptions> = {}): Promise<CID> {
|
|
532
|
-
return
|
|
532
|
+
return cp(source, target, name, this.components.blockstore, options)
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
async * ls (cid: CID, options: Partial<LsOptions> = {}): AsyncIterable<UnixFSEntry> {
|
|
@@ -537,19 +537,19 @@ class DefaultUnixFS implements UnixFS {
|
|
|
537
537
|
}
|
|
538
538
|
|
|
539
539
|
async mkdir (cid: CID, dirname: string, options: Partial<MkdirOptions> = {}): Promise<CID> {
|
|
540
|
-
return
|
|
540
|
+
return mkdir(cid, dirname, this.components.blockstore, options)
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
async rm (cid: CID, path: string, options: Partial<RmOptions> = {}): Promise<CID> {
|
|
544
|
-
return
|
|
544
|
+
return rm(cid, path, this.components.blockstore, options)
|
|
545
545
|
}
|
|
546
546
|
|
|
547
547
|
async stat (cid: CID, options: Partial<StatOptions> = {}): Promise<UnixFSStats> {
|
|
548
|
-
return
|
|
548
|
+
return stat(cid, this.components.blockstore, options)
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
async touch (cid: CID, options: Partial<TouchOptions> = {}): Promise<CID> {
|
|
552
|
-
return
|
|
552
|
+
return touch(cid, this.components.blockstore, options)
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
|