file-meta
v0.0.1
Published
Get useful information about files
Downloads
6
Readme
file-meta
Get useful information about files
Install
$ npm install --save file-meta
Usage
var fileMeta = require('file-meta');
var myFile = fileMeta('/home/wolfika/Documents/gulpfile.babel.js');
myFile.getName();
//=> 'gulpfile'
myFile.getFullName();
//=> 'gulpfile.babel.js'
myFile.getExtension();
//=> ['babel', 'js']
API
fileMeta(filePath)
filePath
Type: string
Path/name of the file you wish to inspect.
.getName()
Returns the name of the file, excluding the extension. In case the file is a dotfile (e.g. .travis.yml
), the full name is returned (.travis.yml
).
.getFullName()
Returns the full name of the file, including the extension.
.getExtension()
Returns a string if the file has one single extension, or an array of extensions, if it has multiple. Returns null
if the file has no extension (e.g. dotfiles, Gemfile
).
License
MIT © Mate Farkas