fix(api): resolve when file is done being written to fs rather than when read stream ends
This commit is contained in:
parent
58d6ec76a9
commit
07f24fb414
@ -26,8 +26,9 @@ const storeFS = ({ stream, filename }) => {
|
||||
fs.unlinkSync(path)
|
||||
reject(error)
|
||||
})
|
||||
.on('end', () => resolve({ id, path }))
|
||||
.pipe(fs.createWriteStream(path))
|
||||
.on('error', error => reject(error))
|
||||
.on('finish', () => resolve({ id, path }))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user