import { importFile } from 'ipfs-unixfs-importer'
import { MemoryBlockstore } from 'blockstore-core'
// store blocks in memory, other blockstores are available
const blockstore = new MemoryBlockstore()
const input: FileCandidate = {
path: './foo.txt',
content: Uint8Array.from([0, 1, 2, 3, 4])
}
const entry = await importFile(input, blockstore)
importFile
is similar toimporter
except it accepts a singleFileCandidate
and returns a promise of a singleImportResult
instead of a stream of results.