create-expo-cljs-app
Version:
Create a react native application with Expo and Shadow-CLJS!
962 lines (845 loc) • 120 kB
TypeScript
declare module 'node:fs' {
export * from 'fs';
}
declare module 'fs' {
import * as stream from 'node:stream';
import EventEmitter = require('node:events');
import { URL } from 'node:url';
import * as promises from 'node:fs/promises';
export { promises };
/**
* Valid types for path values in "fs".
*/
export type PathLike = string | Buffer | URL;
export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
export type BufferEncodingOption = 'buffer' | { encoding: 'buffer' };
export interface BaseEncodingOptions {
encoding?: BufferEncoding | null;
}
export type OpenMode = number | string;
export type Mode = number | string;
export interface StatsBase<T> {
isFile(): boolean;
isDirectory(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
dev: T;
ino: T;
mode: T;
nlink: T;
uid: T;
gid: T;
rdev: T;
size: T;
blksize: T;
blocks: T;
atimeMs: T;
mtimeMs: T;
ctimeMs: T;
birthtimeMs: T;
atime: Date;
mtime: Date;
ctime: Date;
birthtime: Date;
}
export interface Stats extends StatsBase<number> {
}
export class Stats {
}
export class Dirent {
isFile(): boolean;
isDirectory(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
name: string;
}
/**
* A class representing a directory stream.
*/
export class Dir {
readonly path: string;
/**
* Asynchronously iterates over the directory via `readdir(3)` until all entries have been read.
*/
[Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;
/**
* Asynchronously close the directory's underlying resource handle.
* Subsequent reads will result in errors.
*/
close(): Promise<void>;
close(cb: NoParamCallback): void;
/**
* Synchronously close the directory's underlying resource handle.
* Subsequent reads will result in errors.
*/
closeSync(): void;
/**
* Asynchronously read the next directory entry via `readdir(3)` as an `Dirent`.
* After the read is completed, a value is returned that will be resolved with an `Dirent`, or `null` if there are no more directory entries to read.
* Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
*/
read(): Promise<Dirent | null>;
read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void;
/**
* Synchronously read the next directory entry via `readdir(3)` as a `Dirent`.
* If there are no more directory entries to read, null will be returned.
* Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
*/
readSync(): Dirent | null;
}
export interface FSWatcher extends EventEmitter {
close(): void;
/**
* events.EventEmitter
* 1. change
* 2. error
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "close", listener: () => void): this;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
on(event: "error", listener: (error: Error) => void): this;
on(event: "close", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
once(event: "error", listener: (error: Error) => void): this;
once(event: "close", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
prependListener(event: "error", listener: (error: Error) => void): this;
prependListener(event: "close", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this;
prependOnceListener(event: "error", listener: (error: Error) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
}
export class ReadStream extends stream.Readable {
close(): void;
bytesRead: number;
path: string | Buffer;
pending: boolean;
/**
* events.EventEmitter
* 1. open
* 2. close
* 3. ready
*/
addListener(event: "close", listener: () => void): this;
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
addListener(event: "end", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "open", listener: (fd: number) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "readable", listener: () => void): this;
addListener(event: "ready", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "data", listener: (chunk: Buffer | string) => void): this;
on(event: "end", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "open", listener: (fd: number) => void): this;
on(event: "pause", listener: () => void): this;
on(event: "readable", listener: () => void): this;
on(event: "ready", listener: () => void): this;
on(event: "resume", listener: () => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "data", listener: (chunk: Buffer | string) => void): this;
once(event: "end", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "open", listener: (fd: number) => void): this;
once(event: "pause", listener: () => void): this;
once(event: "readable", listener: () => void): this;
once(event: "ready", listener: () => void): this;
once(event: "resume", listener: () => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
prependListener(event: "end", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "open", listener: (fd: number) => void): this;
prependListener(event: "pause", listener: () => void): this;
prependListener(event: "readable", listener: () => void): this;
prependListener(event: "ready", listener: () => void): this;
prependListener(event: "resume", listener: () => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "open", listener: (fd: number) => void): this;
prependOnceListener(event: "pause", listener: () => void): this;
prependOnceListener(event: "readable", listener: () => void): this;
prependOnceListener(event: "ready", listener: () => void): this;
prependOnceListener(event: "resume", listener: () => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export class WriteStream extends stream.Writable {
close(): void;
bytesWritten: number;
path: string | Buffer;
pending: boolean;
/**
* events.EventEmitter
* 1. open
* 2. close
* 3. ready
*/
addListener(event: "close", listener: () => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "finish", listener: () => void): this;
addListener(event: "open", listener: (fd: number) => void): this;
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
addListener(event: "ready", listener: () => void): this;
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "drain", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "finish", listener: () => void): this;
on(event: "open", listener: (fd: number) => void): this;
on(event: "pipe", listener: (src: stream.Readable) => void): this;
on(event: "ready", listener: () => void): this;
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "drain", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "finish", listener: () => void): this;
once(event: "open", listener: (fd: number) => void): this;
once(event: "pipe", listener: (src: stream.Readable) => void): this;
once(event: "ready", listener: () => void): this;
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "finish", listener: () => void): this;
prependListener(event: "open", listener: (fd: number) => void): this;
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependListener(event: "ready", listener: () => void): this;
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "finish", listener: () => void): this;
prependOnceListener(event: "open", listener: (fd: number) => void): this;
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: "ready", listener: () => void): this;
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
/**
* Asynchronous rename(2) - Change the name or location of a file or directory.
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
*/
export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace rename {
/**
* Asynchronous rename(2) - Change the name or location of a file or directory.
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
*/
function __promisify__(oldPath: PathLike, newPath: PathLike): Promise<void>;
}
/**
* Synchronous rename(2) - Change the name or location of a file or directory.
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
*/
export function renameSync(oldPath: PathLike, newPath: PathLike): void;
/**
* Asynchronous truncate(2) - Truncate a file to a specified length.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param len If not specified, defaults to `0`.
*/
export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void;
/**
* Asynchronous truncate(2) - Truncate a file to a specified length.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
*/
export function truncate(path: PathLike, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace truncate {
/**
* Asynchronous truncate(2) - Truncate a file to a specified length.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param len If not specified, defaults to `0`.
*/
function __promisify__(path: PathLike, len?: number | null): Promise<void>;
}
/**
* Synchronous truncate(2) - Truncate a file to a specified length.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param len If not specified, defaults to `0`.
*/
export function truncateSync(path: PathLike, len?: number | null): void;
/**
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
* @param fd A file descriptor.
* @param len If not specified, defaults to `0`.
*/
export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void;
/**
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
* @param fd A file descriptor.
*/
export function ftruncate(fd: number, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace ftruncate {
/**
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
* @param fd A file descriptor.
* @param len If not specified, defaults to `0`.
*/
function __promisify__(fd: number, len?: number | null): Promise<void>;
}
/**
* Synchronous ftruncate(2) - Truncate a file to a specified length.
* @param fd A file descriptor.
* @param len If not specified, defaults to `0`.
*/
export function ftruncateSync(fd: number, len?: number | null): void;
/**
* Asynchronous chown(2) - Change ownership of a file.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace chown {
/**
* Asynchronous chown(2) - Change ownership of a file.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function __promisify__(path: PathLike, uid: number, gid: number): Promise<void>;
}
/**
* Synchronous chown(2) - Change ownership of a file.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function chownSync(path: PathLike, uid: number, gid: number): void;
/**
* Asynchronous fchown(2) - Change ownership of a file.
* @param fd A file descriptor.
*/
export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace fchown {
/**
* Asynchronous fchown(2) - Change ownership of a file.
* @param fd A file descriptor.
*/
function __promisify__(fd: number, uid: number, gid: number): Promise<void>;
}
/**
* Synchronous fchown(2) - Change ownership of a file.
* @param fd A file descriptor.
*/
export function fchownSync(fd: number, uid: number, gid: number): void;
/**
* Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace lchown {
/**
* Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function __promisify__(path: PathLike, uid: number, gid: number): Promise<void>;
}
/**
* Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function lchownSync(path: PathLike, uid: number, gid: number): void;
/**
* Changes the access and modification times of a file in the same way as `fs.utimes()`,
* with the difference that if the path refers to a symbolic link, then the link is not
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param atime The last access time. If a string is provided, it will be coerced to number.
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
*/
export function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace lutimes {
/**
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
* with the difference that if the path refers to a symbolic link, then the link is not
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param atime The last access time. If a string is provided, it will be coerced to number.
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
*/
function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
}
/**
* Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`,
* or throws an exception when parameters are incorrect or the operation fails.
* This is the synchronous version of `fs.lutimes()`.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param atime The last access time. If a string is provided, it will be coerced to number.
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
*/
export function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
/**
* Asynchronous chmod(2) - Change permissions of a file.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace chmod {
/**
* Asynchronous chmod(2) - Change permissions of a file.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
function __promisify__(path: PathLike, mode: Mode): Promise<void>;
}
/**
* Synchronous chmod(2) - Change permissions of a file.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
export function chmodSync(path: PathLike, mode: Mode): void;
/**
* Asynchronous fchmod(2) - Change permissions of a file.
* @param fd A file descriptor.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace fchmod {
/**
* Asynchronous fchmod(2) - Change permissions of a file.
* @param fd A file descriptor.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
function __promisify__(fd: number, mode: Mode): Promise<void>;
}
/**
* Synchronous fchmod(2) - Change permissions of a file.
* @param fd A file descriptor.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
export function fchmodSync(fd: number, mode: Mode): void;
/**
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace lchmod {
/**
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
function __promisify__(path: PathLike, mode: Mode): Promise<void>;
}
/**
* Synchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
*/
export function lchmodSync(path: PathLike, mode: Mode): void;
/**
* Asynchronous stat(2) - Get file status.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
export function stat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
export function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace stat {
/**
* Asynchronous stat(2) - Get file status.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
}
/**
* Synchronous stat(2) - Get file status.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function statSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
export function statSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
export function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
/**
* Asynchronous fstat(2) - Get file status.
* @param fd A file descriptor.
*/
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
export function fstat(fd: number, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
export function fstat(fd: number, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace fstat {
/**
* Asynchronous fstat(2) - Get file status.
* @param fd A file descriptor.
*/
function __promisify__(fd: number, options?: StatOptions & { bigint?: false }): Promise<Stats>;
function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
}
/**
* Synchronous fstat(2) - Get file status.
* @param fd A file descriptor.
*/
export function fstatSync(fd: number, options?: StatOptions & { bigint?: false }): Stats;
export function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
/**
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
export function lstat(path: PathLike, options: StatOptions & { bigint?: false } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
export function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace lstat {
/**
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false }): Promise<Stats>;
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
}
/**
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false }): Stats;
export function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
export function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
/**
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace link {
/**
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
}
/**
* Synchronous link(2) - Create a new link (also known as a hard link) to an existing file.
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function linkSync(existingPath: PathLike, newPath: PathLike): void;
/**
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void;
/**
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
*/
export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace symlink {
/**
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
type Type = "dir" | "file" | "junction";
}
/**
* Synchronous symlink(2) - Create a new symbolic link to an existing file.
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
*/
export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function readlink(
path: PathLike,
options: BaseEncodingOptions | BufferEncoding | undefined | null,
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
): void;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function readlink(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function readlink(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace readlink {
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
}
/**
* Synchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
/**
* Synchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer;
/**
* Synchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function realpath(
path: PathLike,
options: BaseEncodingOptions | BufferEncoding | undefined | null,
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
): void;
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function realpath(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function realpath(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace realpath {
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
function native(
path: PathLike,
options: BaseEncodingOptions | BufferEncoding | undefined | null,
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
): void;
function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
function native(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
}
/**
* Synchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function realpathSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
/**
* Synchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
/**
* Synchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
export function realpathSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
export namespace realpathSync {
function native(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
function native(path: PathLike, options: BufferEncodingOption): Buffer;
function native(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
}
/**
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function unlink(path: PathLike, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace unlink {
/**
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function __promisify__(path: PathLike): Promise<void>;
}
/**
* Synchronous unlink(2) - delete a name and possibly the file it refers to.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function unlinkSync(path: PathLike): void;
export interface RmDirOptions {
/**
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
* `EPERM` error is encountered, Node.js will retry the operation with a linear
* backoff wait of `retryDelay` ms longer on each try. This option represents the
* number of retries. This option is ignored if the `recursive` option is not
* `true`.
* @default 0
*/
maxRetries?: number;
/**
* @deprecated since v14.14.0 In future versions of Node.js,
* `fs.rmdir(path, { recursive: true })` will throw on nonexistent
* paths, or when given a file as a target.
* Use `fs.rm(path, { recursive: true, force: true })` instead.
*
* If `true`, perform a recursive directory removal. In
* recursive mode, errors are not reported if `path` does not exist, and
* operations are retried on failure.
* @default false
*/
recursive?: boolean;
/**
* The amount of time in milliseconds to wait between retries.
* This option is ignored if the `recursive` option is not `true`.
* @default 100
*/
retryDelay?: number;
}
/**
* Asynchronous rmdir(2) - delete a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function rmdir(path: PathLike, callback: NoParamCallback): void;
export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace rmdir {
/**
* Asynchronous rmdir(2) - delete a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
}
/**
* Synchronous rmdir(2) - delete a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
*/
export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
export interface RmOptions {
/**
* When `true`, exceptions will be ignored if `path` does not exist.
* @default false
*/
force?: boolean;
/**
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
* `EPERM` error is encountered, Node.js will retry the operation with a linear
* backoff wait of `retryDelay` ms longer on each try. This option represents the
* number of retries. This option is ignored if the `recursive` option is not
* `true`.
* @default 0
*/
maxRetries?: number;
/**
* If `true`, perform a recursive directory removal. In
* recursive mode, errors are not reported if `path` does not exist, and
* operations are retried on failure.
* @default false
*/
recursive?: boolean;
/**
* The amount of time in milliseconds to wait between retries.
* This option is ignored if the `recursive` option is not `true`.
* @default 100
*/
retryDelay?: number;
}
/**
* Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
*/
export function rm(path: PathLike, callback: NoParamCallback): void;
export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not