fix stream .ons

This commit is contained in:
Ulf Gebhardt 2023-01-25 16:09:58 +01:00
parent 11087cbaef
commit 02a29cc954
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -114,10 +114,11 @@ const localFileUpload = ({ createReadStream, uniqueFilename }) => {
const destination = `/uploads/${uniqueFilename}`
return new Promise((resolve, reject) =>
createReadStream()
.pipe(createWriteStream(`public${destination}`))
.on('finish', () => resolve(destination))
.on('error', reject),
)
.pipe(createWriteStream(`public${destination}`)
.on('finish', () => resolve(destination))
.on('error', (error) => reject(error))
)
)
}
const s3Upload = async ({ createReadStream, uniqueFilename, mimetype }) => {