fsreadfileastype

0.0.4 • Public • Published

fsReadFileAsType

Build Status

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

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Running tests

npm install
npm test

Readme

Keywords

none

Package Sidebar

Install

npm i fsreadfileastype

Weekly Downloads

5

Version

0.0.4

License

none

Last publish

Collaborators

  • createbang