UNPKG

zip-lib

Version:

A zip and unzip library for Node.js.

33 lines (32 loc) 1.23 kB
export interface FileEntry { path: string; isSymbolicLink: boolean; type: FileType; mtime: Date; mode: number; } export type FolderStat = { isDirectory: true; isSymbolicLink: false; } | { isDirectory: false; isSymbolicLink: true; realpath: string; }; export type FileType = "file" | "dir"; /** * Checks if the target path is outside the specified base directory. * * @param basePath - The reference directory. * @param targetPath - The path to evaluate against the base. * @returns `true` if targetPath is outside of basePath. */ export declare function isOutside(basePath: string, targetPath: string): boolean; export declare function realpath(target: string): Promise<string>; export declare function readdirp(folder: string): Promise<FileEntry[]>; export declare function getFileEntry(target: string): Promise<FileEntry>; export declare function ensureFolder(folder: string): Promise<FolderStat>; export declare function pathExists(target: string): Promise<boolean>; export declare function statFolder(folder: string): Promise<FolderStat | undefined>; export declare function rimraf(target: string): Promise<void>; export declare function isRootPath(target: string): boolean;