Skip to content

Commit ac3d176

Browse files
authored
fix: add optional type for file candidate data (#340)
Where we know the type of content to be imported ahead of time (e.g. a Uint8Array or a stream, not both), it can be helpful to specify that type, so make `FileCandidate` generic to allow this. Defaults it to the previous `ImportContent` value so this is non-breaking.
1 parent df6aea8 commit ac3d176

File tree

1 file changed

+2
-2
lines changed
  • packages/ipfs-unixfs-importer/src

1 file changed

+2
-2
lines changed

packages/ipfs-unixfs-importer/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export type ImportContent = ByteStream | Uint8Array
2020

2121
export type WritableStorage = Pick<Blockstore, 'put'>
2222

23-
export interface FileCandidate {
23+
export interface FileCandidate<T extends ImportContent = ImportContent> {
2424
path?: string
25-
content: ImportContent
25+
content: T
2626
mtime?: Mtime
2727
mode?: number
2828
}

0 commit comments

Comments
 (0)