rmapi-js
    Preparing search index...

    Class Document

    a document of the library, as it was when handed out

    An edit returns it as it is after; one of an item purged since throws a NotHeldError.

    Hierarchy

    • TaggedItem
      • Document
    Index
    • get accountSizeBytes(): bigint

      the size of all its files, as the account reports it

      Returns bigint

    • get accountTags(): string[]

      the tags as the account last listed them, without the edits not yet sent

      Returns string[]

    • get bodies(): BodyKind[]

      the kinds of body it has, the epub first and then the pdf, as the account lists them, whatever order its files are in

      Returns BodyKind[]

    • get hash(): string | undefined

      the hash the account lists it at, or undefined if no fetch has seen it

      Returns string | undefined

    • get id(): string

      the id, which finds the item again

      Returns string

    • get lastOpenedIndex(): number | undefined

      the place in the page order of the page the reader was last on, counting from zero

      Returns number | undefined

    • get modifiedAt(): Date

      when it was last renamed or read

      Returns Date

    • get name(): string

      the name shown on the device

      Returns string

    • get needsPageIds(): boolean

      whether it is an epub the tablet never laid out, which lists no page ids until setPageCount gives it some

      Returns boolean

    • get pageCount(): number

      the number of pages pages gives, with the edits not yet sent

      Returns number

    • get starred(): boolean

      whether it is starred

      Returns boolean

    • get tags(): string[]

      the tags, with the edits not yet sent; the account's own are accountTags

      Returns string[]

    • get top(): Top

      where following its parents up ends

      Returns Top

    • get unreadable(): boolean

      whether the last sync could not read it as the account holds it, so it shows as it was last read, or, never read, with only what its .metadata and file list give; an app should show it with a warning

      Returns boolean

    • add the tag name, unless it has it, and return it as it is now

      Parameters

      • name: string

      Returns Promise<Document>

    • every file of it zipped, with the edits not yet sent, as Client.documentArchive zips the account's; a file it does not edit, such as the body, is fetched if the store does not hold it

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • the zip archive makes, as a stream that fetches and zips a file at a time as it is read, so no more than about one file is held at once; it errors as archive throws

      Returns ReadableStream<Uint8Array<ArrayBufferLike>>

    • everything inside it, through folders, each once, as purgeAll would purge it now; none for a document or a template

      Returns Entry[]

    • the file named name in its index, such as <id>.content, if the account lists it

      Parameters

      • name: string

      Returns EntryFile | undefined

    • give an epub that lists no page ids count of them, as setPageCount does, unless it needs none, and return it as it is now

      Parameters

      • count: number

      Returns Promise<Document>

      RangeError if count is not an integer from 0 to 2^32 - 1

    • the size of its files the store holds, in bytes

      Returns Promise<bigint>

    • move it, including into and out of the trash, and return it as it is now

      Parameters

      Returns this

    • purge it for good; what is inside a folder stays and becomes stray

      Returns void

    • purge it and everything inside it, returning the ids queued to purge

      Returns string[]

    • remove the tag name, and return it as it is now

      Parameters

      • name: string

      Returns Promise<Document>

    • rename it, and return it as it is now

      Parameters

      • name: string

      Returns this

    • move it out of the trash to the root, and return it as it is now

      Returns this

    • move it out of the trash into folder, and return it as it is now

      Parameters

      Returns this

    • set the page the reader was last on by its index, and return it as it is now

      An epub with no pdf and no cPages that lists index page ids or fewer first gets ids up to that page, as setPageCount gives them, keeping those it lists, as the reMarkable Mac app does, since the tablet ignores a page past the ids listed.

      Parameters

      • index: number

      Returns Promise<Document>

      RangeError if index is not an integer from 0 to 2^32 - 1

      ContentEditError as setPageCount does

    • set an epub's page ids to count, keeping the ids it lists in order, dropping those past count, and adding new ones after, as setPages sets them, and return it as it is now

      The page count of an epub is a layout the device works out, so this lets a reader that laid it out itself give it ids. A sync whose account copy another device gave ids keeps those and adds to or drops from them.

      Parameters

      • count: number

      Returns Promise<Document>

      RangeError if count is not an integer from 0 to 2^32 - 1

      ContentEditError with reason "hasPdf" if the document has a pdf, "notEpub" if it is not an epub, or "hasPageList" if it has cPages

    • set the page ids of a document without cPages, as the reMarkable Mac app does on opening a document the tablet never laid out, and return it as it is now

      As DocumentContent.setPages does: pages becomes the pages list, redirectionPageMap becomes 0..n, and pageCount and originalPageCount become n. The page edits, such as addPage, can then be made.

      Parameters

      • pages: string[]

      Returns Promise<Document>

      ContentEditError with reason "hasPageList" if the document has cPages, or "duplicatePage" if pages lists an id twice

    • star or unstar it, and return it as it is now

      Parameters

      • starred: boolean

      Returns this

    • fetch each file the account lists for it into the platform's store, unless it holds it, so it reads offline; throws for the first that failed

      Returns Promise<void>

    • move it to the trash, and return it as it is now

      Returns this