rmapi-js
    Preparing search index...

    Interface PendingEntry

    an entry whose upload is still in flight

    The hash is a digest of the bytes, so the entry describes the upload before the server has it — you can splice it into a parent index immediately. Disposing waits for the upload to land, and throws if it failed, so scoping it keeps a root hash from being written against a file that never arrived:

    let hash;
    {
    await using entry = await raw.putFile(`${id}.pdf`, bytes);
    hash = entry.hash;
    }
    await raw.putRootHash(hash, generation);

    Where the number of uploads isn't known until runtime, collect them in an AsyncDisposableStack with stack.use(entry); the scope holding the stack waits for all of them.

    interface PendingEntry {
        hash: string;
        id: string;
        size: number;
        subfiles: number;
        type: 0 | 80000000;
    }

    Hierarchy (View Summary)

    Index
    hash: string

    the hash of the referenced state

    id: string

    the id of the referenced data: a document uuid, or a stored file name

    size: number

    the total size of everything in the collection

    subfiles: number

    the number of subfiles

    type: 0 | 80000000

    80000000 for schema 3 collection type or 0 for schema 4 or schema 3 files or