createStorageRoot
createStorageRoot(
path,options):Promise<StorageRoot>
Defined in: src/storage-root.ts:378
Creates a new OCFL 1.1 storage root in an empty or missing directory.
Parameters
Section titled “Parameters”string
options
Section titled “options”layout
Section titled “layout”Returns
Section titled “Returns”Promise<StorageRoot>
Throws
Section titled “Throws”OcflError DIRECTORY_NOT_EMPTY if path holds anything.
Throws
Section titled “Throws”TypeError if path is missing or empty, the layout or one of its parameters is invalid, or options has a key other than layout.
Throws
Section titled “Throws”The file system error if the directory can’t be made or written to.
Example
Section titled “Example”const root = await createStorageRoot('/srv/ocfl', { layout: { extensionName: '0004-hashed-n-tuple-storage-layout' },});