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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<StorageRoot>
Throws
Section titled “Throws”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.
Throws
Section titled “Throws”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.
Throws
Section titled “Throws”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.
Throws
Section titled “Throws”TypeError if path is missing or empty.
Throws
Section titled “Throws”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.
Example
Section titled “Example”const root = await openStorageRoot('/srv/ocfl');