json-stream-combiner
v2.0.2
Published
Easey way to take json objects or files and write them to a destination file.
Downloads
5
Readme
Json Stream Combiner
A simple API to stream combine many json files, json objects, or array of json objects into a single output file.
npm install json-stream-combiner
If we have this input file:
[
{ "x": 1, "y": 2 },
{ "q": 1, "w": 2 }
]
We can pass that in like this:
import jsonStreamCombiner from 'jsonStreamCombiner';
jsonStreamCombiner([
'/absolute/path/to/json/input.json',
{ a: 1, b: 2 },
[ { c: 1, d: 2 }, { e: 1, d: 2 } ]
],
'/absolute/path/to/json/output.json').then(function() {
console.log('Done!');
})
and then output.json
will have this output:
[
{ "x": 1, "y": 2 },
{ "q": 1, "w": 2 },
{ "a": 1, "b": 2 },
{ "c": 1, "d": 2 },
{ "e": 1, "d": 2 }
]