|
|
@@ -392,10 +392,8 @@ exports.backup = handleError(async (req, res) => {
|
|
|
})(),
|
|
|
(async () => {
|
|
|
const path = 'backup/' + new Date().getTime() + '-chunk.json'
|
|
|
- const chunk = await chunkModel.find()
|
|
|
- fs.writeFile(path, JSON.stringify(chunk), () => {
|
|
|
- console.log('berhasil')
|
|
|
- })
|
|
|
+ const chunk = await chunkModel.find().lean()
|
|
|
+ fs.writeFileSync(path, chunk)
|
|
|
// const { size } = fs.statSync(path)
|
|
|
// const mimetype = 'application/json'
|
|
|
// const buffer = fs.readFileSync(path)
|