fsreadfileastype
v0.0.4
Published
Parse the contents of files as JavaScript objects.
Downloads
9
Readme
fsReadFileAsType
Parse the contents of files as JavaScript objects.
.env file
VAR1=foobar
VAR2=bazbang
.jsonfile file
{
"foo": "bar",
"baz": "bang"
}
js file
var fsReadFileAsType = require('fsreadfileastype');
var jsonData = fsReadFileAsType.sync(__dirname + '/.jsonfile', 'json');
// returns {foo: "bar", baz: "bang"}
var shellVarData = fsReadFileAsType.sync(__dirname + '/.env', 'shell');
// returns {VAR1: "foo", VAR2: "bar"}
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Running tests
npm install
npm test