37 lines
847 B
JavaScript
37 lines
847 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.writeFileSync(
|
|
fullpath,
|
|
// JSON.stringify(jsonObjectThing, null, 2),
|
|
JSON.stringify(jsonObjectThing).replace('\n',''),
|
|
'UTF8',
|
|
(err) => {
|
|
if (err) {
|
|
console.log(`Error writing file: ${err}`)
|
|
} else {
|
|
console.log(`File ${fileName} is written successfully! \n\n ${fullpath}`)
|
|
}
|
|
}
|
|
)
|
|
}
|