Commit a9c5a23c authored by Ahmad Nemati's avatar Ahmad Nemati

git pull

parent f5f12663
const fs = require('fs')
const _=require('lodash')
reader()
async function reader()
{
let files = await fs.readdirSync('torob')
files=_.reverse(files)
if (files.length <2)
return
let file1= await fs.readFileSync('./torob/'+files[0], 'utf8')
file1=JSON.parse(file1)
let file2= await fs.readFileSync('./torob/'+files[1], 'utf8')
file2=JSON.parse(file2)
let arr=[]
for (let i=0;i<file1.length;i++)
arr.push(file1[i])
for (let i=0;i<file2.length;i++)
arr.push(file2[i])
createfileADV(JSON.stringify(arr, null, 2))
}
function createfileADV(data) {
// console.log(data)
return new Promise(function (resolve, reject) {
fs.writeFile('t.json', data, 'utf8', function (err) {
if (err) reject(err);
else resolve(data);
});
});
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment