UNPKG

@codenoobforreal/clitools

Version:

CLI tool for video processing (H.265/HEVC encoding & QuickTime compatibility) using FFmpeg, and batch lossless image compression with format preservation

25 lines 726 B
import path from "node:path"; // Functions related to file paths and extensions /** * get the filename of a the path * * eg:file.ext => file * @param filepath file path * @returns filename */ export function getFileNameFromPath(filepath) { if (filepath.endsWith("\\") || filepath.endsWith("/")) { return ""; } return path.parse(filepath).name; } export function getFileExt(filepath) { return path.extname(filepath).slice(1); } export function resolveAndNormalizePath(inputPath, baseDir) { const resolvedPath = path.isAbsolute(inputPath) ? path.normalize(inputPath) : path.resolve(baseDir, inputPath); return path.normalize(resolvedPath); } //# sourceMappingURL=path.js.map