More detailed statistics relating to a UnixFS DAG. These can involve traversing the DAG behind the CID so can involve network operations and/or more disk activity.

interface ExtendedStats {
    blocks: bigint;
    cid: CID<unknown, number, number, Version>;
    dagSize: bigint;
    deduplicatedDagSize: bigint;
    localSize: bigint;
    mode: number;
    mtime?: Mtime;
    size: bigint;
    type: "file" | "raw" | "directory";
    uniqueBlocks: bigint;
    unixfs?: UnixFS;
}

Hierarchy (view full)

Properties

blocks: bigint

How many blocks make up the DAG.

nb. this will only be accurate if either all blocks are present in the local blockstore or the offline option was not true

cid: CID<unknown, number, number, Version>

The file or directory CID

dagSize: bigint

The size of the DAG that holds the file or directory in bytes - this is the sum of all block sizes so includes any protobuf overhead, etc.

Duplicate blocks are included in this measurement.

nb. this will only be accurate if either all blocks are present in the local blockstore or the offline option was not true

deduplicatedDagSize: bigint

Similar to dagSize except duplicate blocks are not included in the reported amount.

nb. this will only be accurate if either all blocks are present in the local blockstore or the offline option was not true

localSize: bigint

How much of the file or directory is in the local block store. If this is a directory it will include the localSize of all child files and directories.

It does not include protobuf overhead, for that see dagSize.

nb. if the offline option is true, and not all blocks for the file/directory are in the blockstore, this number may be smaller than size.

mode: number

The file or directory mode

mtime?: Mtime

The file or directory mtime

size: bigint

The size in bytes of the file as reported by the UnixFS metadata stored in the root DAG node, or if the CID resolves to a raw node, the size of the block that holds it.

For directories this will return 0 as no size information is available in the root block - instead please stat with the extended option to traverse the DAG and calculate the size.

type: "file" | "raw" | "directory"

The type of UnixFS node - 'file' or 'directory'

uniqueBlocks: bigint

How many unique blocks make up the DAG - this count does not include any blocks that appear in the DAG more than once.

nb. this will only be accurate if either all blocks are present in the local blockstore or the offline option was not true

unixfs?: UnixFS

UnixFS metadata about this file or directory