import { Stats } from 'node:fs'; import { Readable } from 'node:stream'; import { PathType } from './types.ts'; export interface IFsWalkOptions { /** * Ignore unreadable directores when walking directory. * * @default false */ ignoreUnreadableDirectories?: boolean; } export declare const fsLchmodSupported: boolean; export declare const fsLutimesSupported: boolean; /** * Normalize an entry path. * * @param path Path string. * @returns Normalized path. */ export declare function pathNormalize(path: string): string; /** * Get path to the resource fork pseudo-file. * * @param path Path string. * @returns Resource fork pseudo-file path. */ export declare function pathResourceFork(path: string): string; /** * Get path type from stat object, or null if unsupported. * * @param stat Stats object. * @returns Path type. */ export declare function statToPathType(stat: Readonly): PathType.DIRECTORY | PathType.FILE | PathType.SYMLINK | null; /** * Get path type from stat mode, or null if unsupported. * * @param mode Stat mode. * @returns Path type. */ export declare function modeToPathType(mode: number): PathType.DIRECTORY | PathType.FILE | PathType.SYMLINK | null; /** * Get permission bits from mode value. * * @param mode Stat mode. * @returns Permission bits. */ export declare function modePermissionBits(mode: number): number; /** * Check if all the bits set. * * @param value Bits value. * @param mask Mask value. * @returns True of all the bits set. */ export declare function bitwiseAndEqual(value: number, mask: number): boolean; /** * Read a stream into a buffer. * Reading a stream into a buffer should be avoided where possible. * This is however useful for some small streams. * * @param stream Readable stream. * @returns Full buffer. */ export declare function streamToBuffer(stream: Readable): Promise; /** * Wrapper for lchmod, does nothing on unsupported platforms. * * @param path File path. * @param mode File mode. */ export declare function fsLchmod(path: string, mode: number): Promise; /** * Wrapper for utimes. * * @param path File path. * @param atime Access time. * @param mtime Modification time. */ export declare function fsUtimes(path: string, atime: Readonly, mtime: Readonly): Promise; /** * Implementation of lutimes, does nothing on unsupported platforms. * * @param path File path. * @param atime Access time. * @param mtime Modification time. */ export declare function fsLutimes(path: string, atime: Readonly, mtime: Readonly): Promise; /** * A readlink wrapper that returns raw link buffer. * * @param path Link path. * @returns Raw link. */ export declare function fsReadlinkRaw(path: string): Promise; /** * Wrapper for symlink. * * @param path Path of symbolic link. * @param target Target of symbolic link. */ export declare function fsSymlink(path: string | Readonly, target: string | Readonly): Promise; /** * Wrapper for chmod. * * @param path File path. * @param mode File mode. */ export declare function fsChmod(path: string, mode: number): Promise; /** * A readdir wrapper with consistent output. * * @param path Directory path. * @returns Directory listing. */ export declare function fsReaddir(path: string): Promise; /** * An lstat wrapper. * * @param path Path string. * @returns Stat object. */ export declare function fsLstat(path: string): Promise; /** * An lstat wrapper returning null if not exist. * * @param path Path string. * @returns Stat object. */ export declare function fsLstatExists(path: string): Promise; /** * Walk file system path. * If callback returns false skips recursing a directory. * If callback returns null aborts walking. * * @param base Directory path. * @param itter Callback for each entry. * @param options Walk options. */ export declare function fsWalk(base: string, itter: (path: string, stat: Stats) => Promise, options?: Readonly): Promise;