16 lines
591 B
JavaScript
16 lines
591 B
JavaScript
const fs = require("fs")
|
|
let jsonString = fs.readFileSync('/var/www/html/blog/comments-database.js', 'utf8');
|
|
|
|
jsonString=`comments=${jsonString}
|
|
if (typeof module !== "undefined" && module.exports) {
|
|
module.exports = comments;
|
|
}`
|
|
|
|
fs.writeFile("/var/www/html/blog/comments.js", jsonString, (err) => {
|
|
if (err) {
|
|
console.error('Error creating file:', err);
|
|
} else {
|
|
console.log('File created rewritten: Comments.js');
|
|
}
|
|
});
|