export const streamFile = async (imageUrl: string, imageName: string) => {
const filename: string = `${process.env.IMG_DIR}/${imageName}`
const writeFile: fs.WriteStream = fs.createWriteStream(filename)
const res: request.Request = await request(imageUrl)
res.pipe(writeFile)
res.on('data', (chunk: Buffer) => writeFile.write(chunk))
res.on('complete', () => {
writeFile.end()
console.info('Streaming file success')
})
res.on('error', () => console.error('Streaming file error'))
}