
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
file-extension
Advanced tools
Get the extension of a given filename or path
Differences to path.extname
:
.eslintrc
=> eslintrc
)Makefile
=> makefile
)package.json
=> json
)LICENCE
=> licence
)Works in Node.js and the browser. The module's size is currently 267 bytes gzipped.
$ npm install --save file-extension
<script src="file-extension.js"></script>
<!-- Available as global `fileExtension` -->
var fileExtension = require('file-extension'); // Skip this in the browser
// Case insensitive
fileExtension('file.zip'); //=> 'zip'
fileExtension('.Dockerfile'); //=> 'dockerfile'
fileExtension('file'); //=> 'file'
fileExtension('.file.tar'); //=> 'tar'
// Or with case preserved
fileExtension('.Vagrantfile', {preserveCase: true}); //=> 'Vagrantfile'
fileExtension('INDEX.HTML', {preserveCase: true}); //=> 'HTML'
filename
{String} The file name. Required.options
{Object} Options object.preserveCase
{Boolean} Whether case should be preserved. Default: false.© silverwind, distributed under BSD licence
FAQs
Get the extension of a given filename or path
The npm package file-extension receives a total of 85,733 weekly downloads. As such, file-extension popularity was classified as popular.
We found that file-extension demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.