Skip to content
/ dumpjson Public

Dump large Javascript arrays to JSON file without using too much memory

License

Notifications You must be signed in to change notification settings

eldoy/dumpjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DumpJSON

Dump large Javascript arrays to JSON file without using too much memory.

If you're looking for a way to read from JSON file into memory, check out jsonstrom.

Install

npm i dumpjson

Usage

const dumpjson = require('dumpjson')

// Filename to dump to
const writer = dumpjson('file.json')

// Very large array
const largeArray = [...]
for (const item of largeArray) {
  writer.write(item)
}

// Indicate end of stream
writer.end()

// Await if you need to wait for all writes to finish
await writer.end()

MIT Licensed. Enjoy!

About

Dump large Javascript arrays to JSON file without using too much memory

Resources

License

Stars

Watchers

Forks