1
1
import { type ByteStream , type DirectoryCandidate , type FileCandidate , importBytes , importByteStream , type ImportCandidateStream , importDirectory , importer , type ImporterOptions , importFile , type ImportResult } from 'ipfs-unixfs-importer'
2
2
import { fixedSize } from 'ipfs-unixfs-importer/chunker'
3
3
import { balanced } from 'ipfs-unixfs-importer/layout'
4
- import type { Blockstore } from 'interface-blockstore '
4
+ import type { PutStore } from '../unixfs.js '
5
5
import type { CID } from 'multiformats/cid'
6
6
7
7
/**
@@ -18,14 +18,14 @@ const defaultImporterSettings: ImporterOptions = {
18
18
} )
19
19
}
20
20
21
- export async function * addAll ( source : ImportCandidateStream , blockstore : Blockstore , options : Partial < ImporterOptions > = { } ) : AsyncGenerator < ImportResult , void , unknown > {
21
+ export async function * addAll ( source : ImportCandidateStream , blockstore : PutStore , options : Partial < ImporterOptions > = { } ) : AsyncGenerator < ImportResult , void , unknown > {
22
22
yield * importer ( source , blockstore , {
23
23
...defaultImporterSettings ,
24
24
...options
25
25
} )
26
26
}
27
27
28
- export async function addBytes ( bytes : Uint8Array , blockstore : Blockstore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
28
+ export async function addBytes ( bytes : Uint8Array , blockstore : PutStore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
29
29
const { cid } = await importBytes ( bytes , blockstore , {
30
30
...defaultImporterSettings ,
31
31
...options
@@ -34,7 +34,7 @@ export async function addBytes (bytes: Uint8Array, blockstore: Blockstore, optio
34
34
return cid
35
35
}
36
36
37
- export async function addByteStream ( bytes : ByteStream , blockstore : Blockstore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
37
+ export async function addByteStream ( bytes : ByteStream , blockstore : PutStore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
38
38
const { cid } = await importByteStream ( bytes , blockstore , {
39
39
...defaultImporterSettings ,
40
40
...options
@@ -43,7 +43,7 @@ export async function addByteStream (bytes: ByteStream, blockstore: Blockstore,
43
43
return cid
44
44
}
45
45
46
- export async function addFile ( file : FileCandidate , blockstore : Blockstore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
46
+ export async function addFile ( file : FileCandidate , blockstore : PutStore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
47
47
const { cid } = await importFile ( file , blockstore , {
48
48
...defaultImporterSettings ,
49
49
...options
@@ -52,7 +52,7 @@ export async function addFile (file: FileCandidate, blockstore: Blockstore, opti
52
52
return cid
53
53
}
54
54
55
- export async function addDirectory ( dir : Partial < DirectoryCandidate > , blockstore : Blockstore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
55
+ export async function addDirectory ( dir : Partial < DirectoryCandidate > , blockstore : PutStore , options : Partial < ImporterOptions > = { } ) : Promise < CID > {
56
56
const { cid } = await importDirectory ( {
57
57
...dir ,
58
58
path : dir . path ?? '-'
0 commit comments