Trying to fix bug :")

This commit is contained in:
dbroqua 2020-03-30 21:53:17 +02:00
parent 3a88d983fc
commit 9203335963

12
libs.js
View file

@ -213,6 +213,7 @@ const getMedia = (coverUrl, callback) => {
const dest = '/tmp/attachment.jpg'
const file = fs.createWriteStream(dest)
try {
request({
uri: coverUrl,
headers: {
@ -220,15 +221,18 @@ const getMedia = (coverUrl, callback) => {
Connection: 'keep-alive',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
}
})
.pipe(file)
.on('finish', () => {
callback(null, dest)
})
.on('error', (error) => {
console.log(config.colors.FgRed, 'ERR:', error, config.colors.Reset)
callback(error)
})
.pipe(file)
.on('finish', () => {
callback(null, dest)
})
} catch (error) {
callback(error)
}
}
/**