js-ipfs-unixfs
    Preparing search index...

    Module ipfs-unixfs-exporter

    The UnixFS Exporter provides a means to read DAGs from a blockstore given a CID.

    // import a file and export it again
    import { importer } from 'ipfs-unixfs-importer'
    import { exporter } from 'ipfs-unixfs-exporter'
    import { MemoryBlockstore } from 'blockstore-core/memory'

    // Should contain the blocks we are trying to export
    const blockstore = new MemoryBlockstore()
    const files = []

    for await (const file of importer([{
    path: '/foo/bar.txt',
    content: new Uint8Array([0, 1, 2, 3])
    }], blockstore)) {
    files.push(file)
    }

    console.info(files[0].cid) // Qmbaz

    const entry = await exporter(files[0].cid, blockstore)

    if (entry.type !== 'file') {
    throw new Error('Unexpected entry type')
    }

    console.info(entry.cid) // Qmqux
    console.info(entry.path) // Qmbaz/foo/bar.txt
    console.info(entry.name) // bar.txt
    console.info(entry.unixfs.fileSize()) // 4

    // stream content from unixfs node
    const size = entry.unixfs.fileSize()
    const bytes = new Uint8Array(Number(size))
    let offset = 0

    for await (const buf of entry.content()) {
    bytes.set(buf, offset)
    offset += buf.byteLength
    }

    console.info(bytes) // 0, 1, 2, 3

    Classes

    BadPathError
    InvalidParametersError
    NoPropError
    NoResolverError
    NotFoundError
    NotUnixFSError
    OverReadError
    UnderReadError

    Interfaces

    Exportable
    ExporterOptions
    ExportProgress
    ExportWalk
    IdentityNode
    NextResult
    ObjectNode
    RawNode
    Resolve
    Resolver
    ResolveResult
    ShardTraversalContext
    UnixFSDirectory
    UnixFSFile
    UnixfsV1Resolver

    Type Aliases

    ExporterProgressEvents
    ReadableStorage
    UnixFSEntry
    UnixfsV1Content
    UnixfsV1DirectoryContent
    UnixfsV1FileContent

    Functions

    exporter
    recursive
    walkPath