@brighter/storage-adapter-local
Version:
This is a local adapter for the @brighter/storage object storage library.
43 lines (38 loc) • 694 B
TypeScript
import type { StorageInterface } from '@brighter/storage'
/**
* Storage configuration.
*
* @example
* ```js
* const config = {
* path: '/tmp/storage',
* encoding: 'utf8',
* concurrency: 32
* }
* ```
*/
type Config = {
/**
* Storage root path. For example `/tmp/storage`.
*/
path: string
/**
* File encoding. Optional, default is `utf8`.
*/
encoding?: string
/**
* The number of max concurrent tasks running. Optional, default is `32`.
*/
concurrency?: number
}
/**
* Creates the storage.
*
* @example
* ```js
* const storage = Storage({
* path: '/tmp/storage'
* })
* ```
*/
export function Storage(config: Config): StorageInterface