• importDir is similar to importer except it accepts a single DirectoryCandidate and returns a promise of a single ImportResult instead of a stream of results.

    Parameters

    Returns Promise<ImportResult>

    Example

    import { importDirectory } from 'ipfs-unixfs-importer'
    import { MemoryBlockstore } from 'blockstore-core'

    // store blocks in memory, other blockstores are available
    const blockstore = new MemoryBlockstore()

    const input: DirectoryCandidate = {
    path: './foo.txt'
    }

    const entry = await importDirectory(input, blockstore)