@zenfs/core
Version:
A filesystem, anywhere
116 lines (115 loc) • 3.6 kB
TypeScript
import type { Backend, BackendConfiguration, FilesystemOf, SharedConfig } from './backends/backend.js';
import type { Device, DeviceDriver } from './internal/devices.js';
import { log } from 'kerium';
import { FileSystem } from './internal/filesystem.js';
/**
* Update the configuration of a file system.
* @category Backends and Configuration
*/
export declare function configureFileSystem(fs: FileSystem, config: SharedConfig): void;
/**
* Configuration for a specific mount point
* @category Backends and Configuration
*/
export type MountConfiguration<T extends Backend> = FilesystemOf<T> | BackendConfiguration<T> | T;
/**
* Retrieve a file system with `configuration`.
* @category Backends and Configuration
* @see MountConfiguration
*/
export declare function resolveMountConfig<T extends Backend>(configuration: MountConfiguration<T>, _depth?: number): Promise<FilesystemOf<T>>;
/**
* @experimental
* Retrieve a file system with `configuration`.
* @category Backends and Configuration
* @see MountConfiguration
*/
export declare function resolveMountConfigSync<T extends Backend>(configuration: MountConfiguration<T>, _depth?: number): FilesystemOf<T>;
/**
* An object mapping mount points to backends
* @category Backends and Configuration
*/
export interface ConfigMounts {
[K: string]: Backend;
}
/**
* Configuration
* @category Backends and Configuration
*/
export interface Configuration<T extends ConfigMounts> extends SharedConfig {
/**
* An object mapping mount points to mount configuration
*/
mounts: {
[K in keyof T]: MountConfiguration<T[K]>;
};
/**
* The uid to use
* @default 0
*/
uid: number;
/**
* The gid to use
* @default 0
*/
gid: number;
/**
* Whether to automatically add normal Linux devices
* @default false
*/
addDevices: boolean;
/**
* Whether to automatically create some directories (e.g. /tmp)
* @default false
*/
defaultDirectories: boolean;
/**
* If true, disables *all* permissions checking.
*
* This can increase performance.
* @default false
*/
disableAccessChecks: boolean;
/**
* If true, files will only sync to the file system when closed.
* This overrides `disableUpdateOnRead`
*
* This can increase performance.
* @experimental
* @default false
*/
onlySyncOnClose: boolean;
/**
* Configurations options for the log.
*/
log: log.Configuration;
}
/**
* Configures ZenFS with single mount point /
* @category Backends and Configuration
*/
export declare function configureSingle<T extends Backend>(configuration: MountConfiguration<T>): Promise<void>;
/**
* @experimental
* Configures ZenFS with single mount point /
* @category Backends and Configuration
*/
export declare function configureSingleSync<T extends Backend>(configuration: MountConfiguration<T>): void;
/**
* @category Backends and Configuration
*/
export declare function addDevice(driver: DeviceDriver, options?: object): Device;
/**
* Configures ZenFS with `configuration`
* @category Backends and Configuration
* @see Configuration
*/
export declare function configure<T extends ConfigMounts>(configuration: Partial<Configuration<T>>): Promise<void>;
/**
* @experimental
* Configures ZenFS with `configuration`
* @category Backends and Configuration
* @see Configuration
*/
export declare function configureSync<T extends ConfigMounts>(configuration: Partial<Configuration<T>>): void;
export declare function sync(): Promise<void>;