@visulima/fs
Version:
Human friendly file system utilities for Node.js
114 lines (77 loc) • 7.43 kB
TypeScript
import { W as WalkOptions, F as FindUpName, a as FindUpOptions, b as FindUpNameSync, c as WalkEntry, R as ReadFileOptions, C as ContentType, J as JsonValue, d as ReadJsonOptions, e as JsonReviver, f as ReadYamlOptions, Y as YamlReviver, E as EmptyDirOptions, g as WriteFileOptions, h as WriteJsonOptions, i as YamlReplacer } from './packem_shared/observable-like.d-CJo2GVD9.d.mjs';
export { n as CodeFrameLocation, k as FIND_UP_STOP, j as F_OK, o as FindUpNameFnResult, p as FindUpNameSyncFnResult, q as JsonReplacer, l as R_OK, r as ReadFileEncoding, m as W_OK, X as X_OK } from './packem_shared/observable-like.d-CJo2GVD9.d.mjs';
import { symlink } from 'node:fs';
import { brotliDecompress, unzip, brotliDecompressSync, unzipSync } from 'node:zlib';
import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from 'yaml';
declare const ensureDir: (directory: URL | string) => Promise<void>;
declare const ensureDirSync: (directory: URL | string) => void;
declare const ensureFile: (filePath: URL | string) => Promise<void>;
declare const ensureFileSync: (filePath: URL | string) => void;
declare const ensureLink: (source: URL | string, destination: URL | string) => Promise<void>;
declare const ensureLinkSync: (source: URL | string, destination: URL | string) => void;
declare const ensureSymlink: (target: URL | string, linkName: URL | string, type?: symlink.Type) => Promise<void>;
declare const ensureSymlinkSync: (target: URL | string, linkName: URL | string, type?: symlink.Type) => void;
declare const LF: "\n";
declare const CRLF: "\r\n";
declare const EOL: "\n" | "\r\n";
declare const detect: (content: string) => typeof EOL | null;
declare const format: (content: string, eol: typeof EOL) => string;
declare const collect: (directory: string, options?: WalkOptions) => Promise<string[]>;
declare const collectSync: (directory: string, options?: WalkOptions) => string[];
declare const findUp: (name: FindUpName, options?: FindUpOptions) => Promise<string | undefined>;
declare const findUpSync: (name: FindUpNameSync, options?: FindUpOptions) => string | undefined;
declare function walk(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
declare function walkSync(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): IterableIterator<WalkEntry>;
declare function isAccessible(path: URL | string, mode?: number): Promise<boolean>;
declare function isAccessibleSync(path: URL | string, mode?: number): boolean;
type FilePermissions = number;
type Options$2 = {
cwd?: URL | string;
readonly directoryMode?: FilePermissions;
readonly overwrite?: boolean;
};
declare const move: (sourcePath: string, destinationPath: string, options?: Options$2) => Promise<void>;
declare const moveSync: (sourcePath: string, destinationPath: string, options?: Options$2) => void;
declare const rename: (source: string, destination: string, options?: Options$2) => Promise<void>;
declare const renameSync: (source: string, destination: string, options?: Options$2) => void;
declare const decompressionMethods$1: {
readonly brotli: typeof brotliDecompress;
readonly gzip: typeof unzip;
readonly none: (buffer: Buffer, callback: (error: Error | null, result: Buffer) => void) => void;
};
declare const readFile: <O extends ReadFileOptions<keyof typeof decompressionMethods$1> | undefined = undefined>(path: URL | string, options?: O) => Promise<ContentType<O>>;
declare const decompressionMethods: {
readonly brotli: typeof brotliDecompressSync;
readonly gzip: typeof unzipSync;
readonly none: (buffer: Buffer) => Buffer;
};
declare const readFileSync: <O extends ReadFileOptions<keyof typeof decompressionMethods> | undefined = undefined>(path: URL | string, options?: O) => ContentType<O>;
declare function readJson<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): Promise<T>;
declare function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): Promise<T>;
declare function readJsonSync<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): T;
declare function readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): T;
declare function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
declare const emptyDir$1: (dir: URL | string, options?: EmptyDirOptions) => Promise<void>;
declare const emptyDir: (dir: URL | string, options?: EmptyDirOptions) => void;
declare const remove: (path: URL | string, options?: {
maxRetries?: number | undefined;
retryDelay?: number | undefined;
}) => Promise<void>;
declare const removeSync: (path: URL | string, options?: {
maxRetries?: number | undefined;
retryDelay?: number | undefined;
}) => void;
declare const writeFile: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => Promise<void>;
declare const writeFileSync: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => void;
declare const writeJson: (path: URL | string, data: unknown, options?: WriteJsonOptions) => Promise<void>;
declare const writeJsonSync: (path: URL | string, data: unknown, options?: WriteJsonOptions) => void;
type Options$1 = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
declare function writeYaml(path: URL | string, data: any, options?: Options$1): Promise<void>;
declare function writeYaml(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options$1 | number | string): Promise<void>;
type Options = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
declare function writeYamlSync(path: URL | string, data: any, options?: Options): void;
declare function writeYamlSync(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options | number | string): void;
export { CRLF, EOL, EmptyDirOptions, FindUpName, FindUpNameSync, FindUpOptions, JsonReviver, LF, type Options$2 as MoveOptions, ReadFileOptions, ReadJsonOptions, WalkEntry, WalkOptions, WriteFileOptions, WriteJsonOptions, YamlReplacer, collect, collectSync, detect, emptyDir$1 as emptyDir, emptyDir as emptyDirSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, ensureLink, ensureLinkSync, ensureSymlink, ensureSymlinkSync, findUp, findUpSync, format, isAccessible, isAccessibleSync, move, moveSync, readFile, readFileSync, readJson, readJsonSync, readYaml, readYamlSync, remove, removeSync, rename, renameSync, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync, writeYaml, writeYamlSync };