Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
784 B

const fs = require('fs');
const sql = require('../utils/sql');
module.exports=
{
main: function()
{
sql.getSiteMap().then(function(result)
{
var buf = Buffer.from(result, 'utf8');
var path = '../sitemap.txt';
fs.open(path, 'w', function(error, fd)
{
if(error)
throw 'could not open file: ' + error;
fs.write(fd, buf, 0, buf.length, null, function(err)
{
if(err)
throw "error writing file: " + err;
fs.close(fd, function()
{
console.log("Updated Sitemap");
})
});
});
});
}
}