UNPKG

evsecrets

Version:

Detect environment variable secrets in your codebase before you push your code to GitHub.

50 lines (49 loc) 1.64 kB
/** * Utility class for local filesystem operations. * * To read huge text files, consider using a line-by-line streaming approach * in your application code rather than using this class. * Chris Joakim, 2025 */ export declare class FileUtil { constructor(); /** * * @see https://nodejs.org/api/fs.html#fsaccesspath-mode-callback */ fileExists(filename: string): boolean; /** * Return the current directory where this node.js process is running. */ cwd(): string; /** * Return a list of files in the given directory. */ listFilesInDir(dir: string): Array<string>; /** * Read the given filename and return its contents as a text string. */ readTextFileSync(infile: string): string; /** * Read the given filename and return its contents an array * of strings, one per line. */ readTextFileAsLinesSync(infile: string): Array<string>; /** * Write the given string/text content to the given filename. * Return true if successful, else false. */ writeTextFileSync(outfile: string, data: string): boolean; /** * Read the given JSON Array file and return its parsed contents. * The file contents must begin and end with the '[' and ']' characters. */ readJsonArrayFile(infile: string): Array<Object>; /** * Read the given JSON Array file and return its parsed contents. * The file contents must begin and end with the '{' and '}' characters. */ readJsonObjectFile(infile: string): Object; deleteFile(fn: string): void; deleteFilesInDir(dir: string): void; }