Hi I am building this app and I am looking to save different images on the disk, I generate random names for the files so I do not overwrite the previous one, my goal is to save that name file to a db so I can access it later on the front-end, the files get saved to the public directory so I can simply append the file name to the server url like so
The code below show how the function works:
var url = 'https://www.google.com';
app.get('/api', (request, response) => {
webshot( url ,'public/' + Date.now() + '.jpg' , options, function (err) {
if (err) {
console.log(err)
}
else {
console.log('SS OK');
}
});
})
var url = "https://www.google.com"
app.get('/api', (request, response) => {
var filename = Date.now() + '.jpg'
webshot( url ,'public/' + filename , options,
function (err) {
if (err) {
console.log(err)
}
else {
console.log('SS OK')
//save filename in DB
}
});
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.