|
|
@ -13,24 +13,17 @@ module.exports= |
|
|
|
{ |
|
|
|
sql.getSiteMap().then(function(result) |
|
|
|
{ |
|
|
|
var buf = Buffer.from(result, 'utf8'); |
|
|
|
|
|
|
|
var path = '../sitemap.txt'; |
|
|
|
fs.open(path, 'w', function(error, fd) |
|
|
|
console.log(result); |
|
|
|
fs.writeFile("./sitemap.txt", result, function(err) |
|
|
|
{ |
|
|
|
if(error) |
|
|
|
throw 'could not open file: ' + error; |
|
|
|
|
|
|
|
fs.write(fd, buf, 0, buf.length, null, function(err) |
|
|
|
if(err) |
|
|
|
{ |
|
|
|
if(err) |
|
|
|
throw "error writing file: " + err; |
|
|
|
|
|
|
|
fs.close(fd, function() |
|
|
|
{ |
|
|
|
console.log("Updated Sitemap"); |
|
|
|
}) |
|
|
|
}); |
|
|
|
console.log(err); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
console.log("sitemap updated"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|