UNPKG

memdisk

Version:

A library and a CLI to create RAM disk on macOS and Linux.

29 lines (27 loc) 1.24 kB
type SupportedPlatform = 'darwin' | 'linux'; declare const isSupportedPlatform: (platform: string) => platform is SupportedPlatform; interface CreateOptions { /** @default true */ quiet?: boolean; /** @default false */ throwOnNotSupportedPlatform?: boolean; /** @default false */ darwinUseHFSPlus?: boolean; } interface DestroyOptions extends CreateOptions { force?: boolean; } type ErrorBack<R, E = unknown> = [R] extends [void] ? (err: E) => void : (err: E, result: R) => void; interface Create { sync: (name: string, bytes: number, options?: CreateOptions) => string; async: (name: string, bytes: number, options?: CreateOptions) => Promise<string>; errback: (name: string, bytes: number, options: CreateOptions | undefined, callback: ErrorBack<string>) => void; } declare const create: Create; interface Destroy { sync: (root: string, options?: DestroyOptions) => void; async: (root: string, options?: DestroyOptions) => Promise<void>; errback: (root: string, options: DestroyOptions | undefined, callback: ErrorBack<void>) => void; } declare const destroy: Destroy; export { type CreateOptions, type DestroyOptions, type SupportedPlatform, create, destroy, isSupportedPlatform };