Skip to the content.

Get File Extension

Get the extension of a file path.

npm npm downloads CI codecov

Ported from Browserify ❀

Install

npm install @ultirequiem/file-extension

Usage

ESM only, types included: the same import works in Node.js, Bun and browsers.

import { extname } from "@ultirequiem/file-extension";

extname("main.py"); // .py

extname({ path: "App.js", leadingPeriod: true }); // .js

extname({ path: "mod.ts", leadingPeriod: false }); // ts

Support

Open an Issue, I will check it as soon as possible πŸ‘€

If you want to hurry me up a bit send me a tweet πŸ˜†

Don’t forget to star the repo ⭐

Versioning

We use Semantic Versioning. For the versions available, see the tags 🏷️

Licence

Licensed under the MIT License πŸ“„