import type { ChecksumBase } from './squared'; import type { StreamAction } from './asset'; import type { HashOptions } from 'crypto'; import type { Readable } from 'stream'; export const enum NORMALIZE_FLAGS { NONE = 0, RESOLVE = 1, ENSURE_DIR = 2, POSIX = 4 } export interface RequireAction { requireExt?: ArrayOf | boolean; } export interface ThrowsAction { throwsPermission?: boolean; throwsDoesNotExist?: boolean; } export interface ExecAction { uid?: number | string; gid?: number | string; } export interface IncludeAction { include?: T; exclude?: T; } export interface PermissionOptions { ownPermissionOnly?: boolean; hostPermissionOnly?: boolean; } export interface FileSystemOptions extends PermissionOptions, ThrowsAction { absolutePath?: boolean; ignorePermission?: boolean; } export interface ReadFileOptions extends FileSystemOptions, StreamBase, RequireAction { cache?: boolean; encoding?: BufferEncoding; } export interface WriteFileOptions extends FileSystemOptions { overwrite?: boolean; encoding?: BufferEncoding; } export interface DeleteFileOptions extends FileSystemOptions { emptyDir?: boolean; } export interface CopyFileOptions extends FileSystemOptions { overwrite?: boolean; createDir?: boolean; outSrc?: string; } export interface RemoveDirOptions extends FileSystemOptions { emptyDir?: boolean; recursive?: boolean; } export type MoveFileOptions = CopyFileOptions; export type CreateDirOptions = FileSystemOptions; export interface ParseFunctionOptions extends RequireAction { absolute?: boolean; sync?: boolean; external?: boolean; context?: unknown; } export interface CheckSemVerOptions extends MinMax { equals?: string; includes?: boolean; startDir?: string; unstable?: boolean; } export interface CopyDirOptions { move?: boolean; recursive?: boolean | number; symFile?: boolean; symDir?: boolean; ignoreFile?: RegExp; ignoreDir?: RegExp; silent?: boolean; overwrite?: boolean; } export interface CopyDirResult { success: string[]; failed: string[]; ignored: string[]; } export interface GlobDirOptions { exclude?: ArrayOf; recursive?: boolean | number; matchBase?: boolean; dot?: boolean; contains?: boolean; } export interface StreamBase extends StreamAction { signal?: AbortSignal; } export interface ReadHashOptions extends ChecksumBase, StreamBase { chunkSize?: number; } export interface ReadBufferOptions extends StreamBase { encoding?: BufferEncoding; cache?: boolean; } export interface AsHashOptions extends HashOptions, ChecksumBase {} export interface TempDirOptions { pathname?: string; filename?: string; moduleDir?: boolean; uuidDir?: boolean; createDir?: boolean; increment?: number; } export type ReadTextOptions = ReadBufferOptions; export type ReadFileCallback = (err: Null, data?: T) => void; export type ProtocolType = "http" | "https" | "http/s" | "ftp" | "sftp" | "s/ftp" | "torrent" | "unc" | "file"; export type FileTypeFormat = Bufferable | Uint8Array | ArrayBuffer | Readable;