@zenfs/core
Version:
A filesystem, anywhere
62 lines (61 loc) • 2.05 kB
TypeScript
import { type Exception } from 'kerium';
import type * as fs from 'node:fs';
import type { Worker as NodeWorker } from 'node:worker_threads';
import { type OptionalTuple } from 'utilium';
import type { V_Context } from './internal/contexts.js';
declare global {
function atob(data: string): string;
function btoa(data: string): string;
}
/**
* Decodes a directory listing
* @hidden
*/
export declare function decodeDirListing(data: Uint8Array): Record<string, number>;
/**
* Encodes a directory listing
* @hidden
*/
export declare function encodeDirListing(data: Record<string, number>): Uint8Array;
export type Callback<Args extends unknown[] = [], NoError = null> = (e: Exception | NoError, ...args: OptionalTuple<Args>) => unknown;
/**
* Normalizes a mode
* @param def default
* @internal
*/
export declare function normalizeMode(mode: unknown, def?: number): number;
/**
* Normalizes a time
* @internal
*/
export declare function normalizeTime(time: fs.TimeLike): number;
/**
* Normalizes a path
* @internal
* @todo clean this up and make it so `path.resolve` is only called when an explicit context is passed (i.e. `normalizePath(..., $)` to use `path.resolve`)
*/
export declare function normalizePath(this: V_Context, p: fs.PathLike, noResolve?: boolean): string;
/**
* Normalizes options
* @param options options to normalize
* @param encoding default encoding
* @param flag default flag
* @param mode default mode
* @internal
*/
export declare function normalizeOptions(options: fs.WriteFileOptions | (fs.EncodingOption & {
flag?: fs.OpenMode;
}) | undefined, encoding: (BufferEncoding | null) | undefined, flag: string, mode?: number): fs.ObjectEncodingOptions & {
flag: string;
mode: number;
};
/**
* Converts a glob pattern to a regular expression
* @internal
*/
export declare function globToRegex(pattern: string): RegExp;
export declare function waitOnline(worker: NodeWorker): Promise<void>;
/**
* @internal @hidden
*/
export declare function _tempDirName(prefix: fs.PathLike): string;