4.0.2 • Published 3 years ago

parse-dir v4.0.2

Weekly downloads
118
License
MIT
Repository
github
Last release
3 years ago

parse-dir Build Status

=========

Greenkeeper badge

Node lib to recursively read the files in a directory and return their contents.

Installation

npm install parse-dir

Usage

parseDir(glob, callback);

Or, if you prefer to make it synchronous:

var result = parseDir(glob);
var otherResult = parseDir.sync(otherGlob);

Example

var parseDir = require('parse-dir');

parseDir('*', function(err, files) {

});

Output

[
  {
    fullpath: '/path/to/file.ext',
    filename: 'file.ext',
    basename: 'file',
    extension: '.ext',
    raw: 'raw contents of file',
    contents: 'parsed contents of file',
    parsed: true|false //if file is supported, it will parse the contents.  If false, contents == raw.  See Parsing Files.
  }
]

Parsing Files

If parseDir knows how to parse a file, it will attempt to read it and turn it into a javascript object.

Supported Files

  • YAML
  • JSON
  • JS
  • CoffeeScript
  • Livescript
4.0.2

3 years ago

4.0.1

5 years ago

4.0.0

6 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago

0.1.0

8 years ago

0.0.2

10 years ago

0.0.1

10 years ago