Skip to content
Back to top

# TreeArchive

only mutool run

## Constructors

class TreeArchive()

  Create a new empty tree archive.

      var treeArchive = new mupdf.TreeArchive()

## Instance methods

TreeArchive.prototype.add(name, buffer)

  Add a named buffer to a tree archive.

  Arguments:

    - name (`string`) – Name of archive entry to add.

    - buffer (`Buffer | ArrayBuffer | Uint8Array | string`) – Buffer of data to store with the entry.

      var buf = new mupdf.Buffer()
      buf.writeLine("hello world!")
      var archive = new mupdf.TreeArchive()
      archive.add("file2.txt", buf)
      print(archive.hasEntry("file2.txt"))