UNPKG

@resk/core

Version:

An innovative TypeScript framework that empowers developers to build applications with a fully decorator-based architecture for efficient resource management. By combining the power of decorators with a resource-oriented design, DecorRes enhances code cla

19 lines (18 loc) 825 B
/** * Extracts the file extension from a provided string (filename or file path). * * @param filePath - The file path or filename string to extract extension from * @param options - Configuration options for the extraction * @param withoutDot - If true, returns extension without the dot prefix (default: false) * @returns The file extension with or without dot, or empty string if no extension found * * @example * ```typescript * getFileExtension('document.pdf') // Returns '.pdf' * getFileExtension('document.pdf', { withoutDot: true }) // Returns 'pdf' * getFileExtension('/path/to/file.txt') // Returns '.txt' * getFileExtension('file') // Returns '' * getFileExtension('archive.tar.gz') // Returns '.gz' * ``` */ export declare function getFileExtension(filePath: string, withoutDot?: boolean): string;