UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

18 lines (17 loc) • 719 B
import path from "node:path"; //#region packages/media-core/src/file-name.ts /** Returns the final filename segment for either POSIX or Windows-style paths. */ function basenameFromAnyPath(e) { const t = path.win32.basename(path.posix.basename(e)); return t === "." || t === ".." ? "" : t; } /** Returns the extension from the final filename segment of any path flavor. */ function extnameFromAnyPath(e) { return path.extname(basenameFromAnyPath(e)); } /** Returns the extensionless filename from the final segment of any path flavor. */ function nameFromAnyPath(e) { return path.parse(basenameFromAnyPath(e)).name; } //#endregion export { extnameFromAnyPath as n, nameFromAnyPath as r, basenameFromAnyPath as t };