Skip to content

jarofghosts/json-readdir-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-readdir-stream

Build Status npm install npm version js-standard-style License

like levelup's createReadStream() for a directory of JSON files

example

var path = require('path')
var fs = require('fs')

var jrs = require('json-readdir-stream')

// takes a directory and an options object, options shown with defaults
var stream = jrs(path.join(__dirname, 'json-files'), {
  start: '', // start at the beginning
  end: '', // ..end at the end
  reverse: false, // stream in alphabetical order
  keys: true, // include keys in stream
  values: true, // include values in stream
  limit: -1 // limit results to value, -1 is no limit
})

stream.pipe(fs.createWriteStream('./db-backup.txt'))

notes

if keys is false, only the values will be streamed (as strings). if values is false, only the keys will be streamed (as strings)

further reading available at levelup's docs

license

MIT

About

levelup's createReadStream for a dir of json files

Resources

License

Stars

Watchers

Forks

Packages

No packages published