Skip to content

openStorageRoot

openStorageRoot(path): Promise<StorageRoot>

Defined in: src/storage-root.ts:403

Opens an existing storage root. Its layout is read from its own ocfl_layout.json.

string

Promise<StorageRoot>

OcflError STORAGE_ROOT_NOT_FOUND if path is missing, with no file above it, or is an empty directory; createStorageRoot can make a storage root there.

OcflError INVALID_STORAGE_ROOT if anything else at path is not a storage root, or it has no ocfl_layout.json; the message says to add one naming the storage layout, and lists the layouts this library implements.

OcflError UNSUPPORTED_LAYOUT if it declares a layout this library doesn’t implement; the message names it, lists the layouts this library implements, and says to ask for it to be added.

TypeError if path is missing or empty.

The file system error if path has no declaration and can’t be read, or the storage root declaration, ocfl_layout.json or the storage layout’s config.json exists but can’t be read.

const root = await openStorageRoot('/srv/ocfl');