36 lines
788 B
JavaScript
36 lines
788 B
JavaScript
import fs from 'node-fs'
|
|
|
|
export const headersTsv = 'amount\t' +
|
|
'content\t' +
|
|
'description\t' +
|
|
'destination\t' +
|
|
'end\t' +
|
|
'kind of activity\t' +
|
|
'person\t' +
|
|
'place\t' +
|
|
'source\t' +
|
|
'start\t' +
|
|
'unique id\t' +
|
|
'url\t'
|
|
|
|
const outputAbsolutePath = '/home/tykayn/Nextcloud/ressources/social sorting/output/'
|
|
|
|
export async function writeFileInOuputFolderFromJsonObject (fileName, jsonObjectThing) {
|
|
|
|
// console.log('statistics.dates', statistics.dates)
|
|
let fullpath = `${outputAbsolutePath}${fileName}`
|
|
|
|
return await fs.writeFile(
|
|
fullpath,
|
|
JSON.stringify(jsonObjectThing, null, 2),
|
|
'utf8',
|
|
(err) => {
|
|
if (err) {
|
|
console.log(`Error writing file: ${err}`)
|
|
} else {
|
|
console.log(`File ${fileName} is written successfully! \n\n ${fullpath}`)
|
|
}
|
|
}
|
|
)
|
|
}
|