noznarb's picture
Upload 4 files
3bd5401
raw
history blame
535 Bytes
const fs = require('fs');
function loadAndConcatJSON(files, callback)
{
let data = [];
for (let file of files)
{
data.push(require(file));
}
let output = [].concat(...data);
output = JSON.stringify(output);
fs.writeFile('output.json', output, err =>
{
if (err)
{
callback(err);
} else
{
callback(null, output);
}
});
}
loadAndConcatJSON(['./filtered-vicuna-formatted.json', './filtered.json'], (err, result) => {
if (err)
{
console.error(err);
}
else
{
console.log("Merged JSON files.");
}
});