1.3.0 • Published 10 years ago

directory-to-json v1.3.0

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

directory-to-json

NPM version Downloads

Write a representation of a directory to a JSON file. Small wrapper around directory-to-object.

Installation

$ npm install directory-to-json

Usage

const dtj = require('directory-to-json')

dtj('./mydir', './outfile.json', (err) => console.log(err))

API

dto(opts|inPath, outPath, callback)

dtj(path.resolve('./test'), './outfile.json', (err, res) => console.log(res))

// `noDot` ignores files which have a leading `.`
// in the filename.
const opts = {noDot: true, path: path.resolve('./test')}
dto(opts, './outfile.json', (err, res) => console.log(res))

Why?

When parsing several directories of files it's nice to just have to provide a path rather than creating an index object manually. This is useful for creating static sites out of markdown files. Client-side projects can't call a read function dynamically however, so a static file must be created.

See Also

License

MIT

1.3.0

10 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago