js-ipfs-unixfs
    Preparing search index...

    Interface UnixFSFile

    If the entry is a file, entry.content() returns an async iterator that yields one or more Uint8Arrays containing the file content:

    if (entry.type === 'file') {
    for await (const chunk of entry.content()) {
    // chunk is a Buffer
    }
    }
    interface UnixFSFile {
        cid: CID;
        name: string;
        node: PBNode;
        path: string;
        size: bigint;
        type: "file";
        unixfs: UnixFS;
        content(
            options?: ExportContentOptions,
        ): AsyncGenerator<Uint8Array<ArrayBufferLike>, void, unknown>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Methods

    Properties

    cid: CID

    The CID of the entry

    name: string

    The name the entry is stored under within the directory

    node: PBNode
    path: string

    The path of the entry within the containing directory structure

    size: bigint

    The size of the entry

    type: "file"

    A disambiguator to allow TypeScript to work out the type of the entry.

    if (entry.type === 'file') {
    // access UnixFSFile properties safely
    }

    if (entry.type === 'directory') {
    // access UnixFSDirectory properties safely
    }
    unixfs: UnixFS

    Methods