Skip to content

StefanHamminga/node-get-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

get-extension

Parses a string for a file and returns its extension.

Configuration

Property Default Description
strict false Loose string parsing tries to strip trailing whitespace & characters
mode "normal" Simple parsing (last . separated token) or 'normal', return two possible tokens (eg. 'tar.xz')
testSecondLevel false If true, test any two-token extension against a built-in whitelist

Usage

npm install --save get-extension
var getExt = require('get-extension')(config);

console.log(
  getExt('some/dir/file.tar.gz')
);

Examples

Example files can be found in the /examples directory in this repository.

Notes & license

This project is available on GitHub and npm.

The project is licensed as LGPLv3, the license file is included in the project directory.

Copyright 2015 Stefan Hamminga - prjct.net

About

Obtain the extension of a supplied (filename) string

Resources

License

Stars

Watchers

Forks

Packages

No packages published