@storm-software/config-tools
Version:
A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.
45 lines (43 loc) • 1.29 kB
TypeScript
declare const removeExtension: (filePath?: string) => string;
interface FindFileNameOptions {
/**
* Require the file extension to be present in the file name.
*
* @defaultValue false
*/
requireExtension?: boolean;
/**
* Return the file extension as part of the full file name result.
*
* @defaultValue true
*/
withExtension?: boolean;
}
/**
* Find the file name from a file path.
*
* @example
* ```ts
* const fileName = findFileName("C:\\Users\\user\\Documents\\file.txt");
* // fileName = "file.txt"
* ```
*
* @param filePath - The file path to process
* @param options - The options to use when processing the file name
* @returns The file name
*/
declare function findFileName(filePath: string, { requireExtension, withExtension }?: FindFileNameOptions): string;
/**
* Find the full file path's directories from a file path.
*
* @example
* ```ts
* const folderPath = findFilePath("C:\\Users\\user\\Documents\\file.txt");
* // folderPath = "C:\\Users\\user\\Documents"
* ```
*
* @param filePath - The file path to process
* @returns The full file path's directories
*/
declare function findFilePath(filePath: string): string;
export { type FindFileNameOptions, findFileName, findFilePath, removeExtension };