Skip to content

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.

string

LayoutConfig

Promise<StorageRoot>

OcflError DIRECTORY_NOT_EMPTY if path holds anything.

TypeError if path is missing or empty, the layout or one of its parameters is invalid, or options has a key other than layout.

The file system error if the directory can’t be made or written to.

const root = await createStorageRoot('/srv/ocfl', {
layout: { extensionName: '0004-hashed-n-tuple-storage-layout' },
});