htdocs/node/createcomments.js

16 lines
591 B
JavaScript
Raw Normal View History

2024-10-31 14:52:17 +01:00
const fs = require("fs")
2024-11-02 02:03:32 +01:00
let jsonString = fs.readFileSync('/var/www/html/blog/comments-database.js', 'utf8');
2024-10-31 14:52:17 +01:00
jsonString=`comments=${jsonString}
if (typeof module !== "undefined" && module.exports) {
module.exports = comments;
}`
2024-11-02 02:03:32 +01:00
fs.writeFile("/var/www/html/blog/comments.js", jsonString, (err) => {
2024-10-31 14:52:17 +01:00
if (err) {
console.error('Error creating file:', err);
} else {
console.log('File created rewritten: Comments.js');
}
});