npm.io
0.0.1 • Published 10 years ago

file-meta

Licence
MIT
Version
0.0.1
Deps
0
Vulns
0
Weekly
0

file-meta Build Status Coverage Status

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

Keywords