import { Options } from 'micromatch'; import { Options as Options$1 } from 'globby'; /** * Compare two files base on their computed hash rather than just size or timestamp * @param file1 required string path to file 1 * @param file2 required string path to file 2 * @param algo option string algorithm for hash computation * @returns boolean indicating if compare succeeded */ declare const fileCompare: (file1: string, file2: string, algo: "sha1" | "md5") => Promise; /** * Sync Returns true if a filepath exists on the file system and it's directory. * @param path The given path * @throws Error('expected path to be a string') if `path !== 'string'` */ declare const isDirectory: (path: string) => boolean; declare function readJsonFromFile(fileFrom: string): T; declare const writeJsonToFile: (saveTo: string, content: any) => void; declare const writeJsonToBuffer: (content: any) => Buffer; /** * Returns true if filename matches a junk file. * @param filename normally it should be path.basename() * @returns */ declare const isJunkFile: (filename: string) => boolean; /** * Returns true if filename does not match a junk file. * @param filename normally it should be path.basename() * @returns */ declare const isNotJunkFile: (filename: string) => boolean; /** * Ensure your string ends with a slash. * @param str * @param slashEndfix * @returns */ declare const ensureSlash: (str: string, slashEndfix?: boolean) => string; /** * Returns true if every string in the given list matches any of the given glob patterns. * @param str The string to test. * @param pattern One or more glob patterns to use for matching. * @param options https://github.com/micromatch/micromatch#options * @returns */ declare const isPathMatch: (str: string, pattern: string | string[], options?: Options) => boolean; /** * Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar * Forward-slash paths can be used in Windows as long as they're not extended-length paths. * This was created since the path methods in Node.js outputs \\ paths on Windows. * @param path * @returns */ declare const normalizeSlash: (path: string) => string; /** * Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). * @param path the path */ declare const rmrfSync: (path: string) => void; /** * Similar to rimraf, but looking files and directories using glob patterns. * @param pattern * @param options */ declare const rmrfSyncByPattern: (pattern: string | readonly string[], options?: Options$1) => string[]; /** * Traversing the file system and returning pathnames that matched a defined set of a specified pattern according to the rules * Note '!**\/__MACOSX/**', '!**\/*.DS_Store' will be ignored. * @example * ```ts * // https://github.com/mrmlnc/fast-glob * const files = fileWalkSync('**\/*.*', { * cwd: fixtureCwd, * ignore: ['**\/*.{jpg,png}'], * }); * ``` * @returns */ declare const fileWalkSync: (pattern: string | readonly string[], options?: Options$1) => string[]; /** * Traversing the file system and returning pathnames that matched a defined set of a specified pattern according to the rules * @example * ```ts * // https://github.com/mrmlnc/fast-glob * const files = await fileWalk('**\/*.*', { * cwd: fixtureCwd, * ignore: ['**\/*.{jpg,png}'], * }); * ``` * @returns */ declare const fileWalk: (pattern: string | readonly string[], options?: Options$1) => Promise; interface ZipOptions { /** * e.g. `/Users/Documents/xxxx` */ relativePathTo: string; } /** * Compress the specified list of files and keep the file directory of the ZIP package as the specified relative path * Note the jszip depends `dom` to load `lib.dom.d.ts` * @param fileNames All files with full path * @param saveTo Where will zip save to? * @param options Some configurations while ziping. */ declare const zipFiles: (fileNames: string[], saveZipTo: string, options: ZipOptions) => string; /** * Zip matched files into .zip file * @param cwd absolute directory path. * @param saveTo the directory Where can save it to * @param options zip configuration */ declare const zip: (cwd: string, saveTo: string, options: ZipOptions) => Promise; /** * Decompress zip files directly to disk * @param zipFile The absolute file path for this zip, or zip buffer data. * @param extractTo Extracts the specified file to the specified location * @param filter Each zip file path should matches all given glob patterns */ declare const unzip: (zipFile: string | Buffer, extractTo: string, filter?: string[]) => string; /** * Extract file from zip to Buffer * @param zipFileName The absolute file path for this zip. * @param zipEntryName `test.txt` * @returns Buffer */ declare const extractFileFromZip: (zipFileName: string, zipEntryName: string) => Buffer | null; /** * Provider method to simulate __dirname veriable. * @param url import.meta.url * @param subDir sub directory * @returns __dirname */ declare const getDirname: (url: string, subDir?: string) => string; declare function mergeDirs(src: string, dest: string, conflict?: 'skip' | 'overwrite'): void; export { type ZipOptions, ensureSlash, extractFileFromZip, fileCompare, fileWalk, fileWalkSync, getDirname, isDirectory, isJunkFile, isNotJunkFile, isPathMatch, mergeDirs, normalizeSlash, readJsonFromFile, rmrfSync, rmrfSyncByPattern, unzip, writeJsonToBuffer, writeJsonToFile, zip, zipFiles };