import fs from "node:fs/promises"; import { fileURLToPath as n_fileURLToPath, pathToFileURL as n_pathToFileURL } from "node:url"; import { Readable } from "node:stream"; import path from "node:path"; import type { DirItem, FileState } from "./common.ts"; declare function writeResponseToFile_node(response: Response, filePath: string, createDir?: boolean): Promise; export declare const writeResponseToFile: typeof writeResponseToFile_node; export declare function nodeStreamToWebStream(nodeStream: Readable, debugInfos?: string): ReadableStream; export declare function webStreamToNodeStream(webStream: ReadableStream): Readable; export declare const createResponseFromFile: (filePath: string, status?: number, headers?: { [key: string]: string; } | Headers) => Response; export declare function getFileSize(filePath: string): Promise; export declare function getFileStat(filePath: string): Promise; export declare function getMimeTypeFromName(fileName: string): string; export declare function mkDir(dirPath: string): Promise; export declare function rmDir(dirPath: string): Promise; export declare const fileURLToPath: ((url: string) => string) | typeof n_fileURLToPath; export declare const pathToFileURL: typeof n_pathToFileURL; export declare function unlink(filePath: string): Promise; export declare function writeTextToFile(filePath: string, text: string, createDir?: boolean): Promise; export declare function appendTextToFile(filePath: string, text: string): Promise; export declare function writeTextToFileSync(filePath: string, text: string, createDir?: boolean): void; export declare function readTextFromFile(filePath: string, throwError?: boolean): Promise; export declare function readTextFromFileSync(filePath: string, throwError?: boolean): string; export declare function readJsonFromFile(filePath: string, throwError?: boolean): Promise; export declare function readJsonFromFileSync(filePath: string, throwError?: boolean): T; export declare function isFile(filePath: string): Promise; export declare function isDirectory(filePath: string): Promise; export declare function isDirectorySync(dirPath: string): boolean; export declare function isFileSync(dirPath: string): boolean; declare function readFileToBytes_node(filePath: string): Promise; export declare const readFileToBytes: typeof readFileToBytes_node; export declare function getRelativePath(fromDir: string, absolutePath: string): string; export declare function dirItemFromFile(filePath: string): DirItem; export declare function dirItemFromDir(dirPath: string): DirItem; export declare function listDir(dirPath: string): Promise; declare function calcFileHash_bun(filePath: string): Promise; /** * Calculate the hash of a file. * Allows using it for HTTP ETag or another change proof. * This version is optimized to use streams and avoid loading the whole file in memory. */ export declare const calcFileHash: typeof calcFileHash_bun; /** * Convert a simple win32 path to a linux path. */ export declare function win32ToLinuxPath(filePath: string): string; /** * Copy a directory recursively. * Is optimized for large files. */ export declare function copyDirectory(srcDir: string, destDir: string): Promise; /** * Copy of a file. * Is optimized for large files. */ export declare function copyFile(srcPath: string, destPath: string): Promise; /** * Unzip a .zip file in an optimized way. * Note was using : "@types/unzipper": "^0.10.11" * which has some bug, files/folders was forgottens. * import * as unzipper from "unzipper"; */ /** * Unzip a .zip file in an optimized way. */ export declare function unzipFile(zipFilePath: string, outputDir: string): Promise; /** * Create a temporary directory. * Return an object containing the directory path and a cleanup function. */ export declare function createTempDir(prefix: string): Promise<{ path: string; remove: () => Promise; }>; export declare const join: typeof path.join; export declare const resolve: typeof path.resolve; export declare const dirname: typeof path.dirname; export declare const extname: typeof path.extname; export declare const relative: typeof path.relative; export declare const sep: "/" | "\\"; export declare const isAbsolute: typeof path.isAbsolute; export declare const normalize: typeof path.normalize; export declare const basename: typeof path.basename; export declare const symlink: typeof fs.symlink; export declare const rename: typeof fs.rename; export {};