-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Ruslan Konev edited this page Sep 16, 2016
·
2 revisions
const fs = require('fs');
// Upgrade structure of json-files from 0.1.* to 0.2
let files = fs.readdirSync('./stores/db', 'utf8');
if (files && files.length) {
files.forEach( item => {
let file = './stores/db/' + item;
console.log(`process [${file}] file`);
let data = require(file);
let newData = {
"updated_at": Date.now(),
"entries": data
}
fs.writeFileSync(file, JSON.stringify(newData), 'utf8')
})
}