Merge pull request #4 from SavePointSam/file_upload_race
fix(api): resolve when file is done being written to fs
This commit is contained in:
commit
46978af0af
@ -26,8 +26,9 @@ const storeFS = ({ stream, filename }) => {
|
|||||||
fs.unlinkSync(path)
|
fs.unlinkSync(path)
|
||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
.on('end', () => resolve({ id, path }))
|
|
||||||
.pipe(fs.createWriteStream(path))
|
.pipe(fs.createWriteStream(path))
|
||||||
|
.on('error', error => reject(error))
|
||||||
|
.on('finish', () => resolve({ id, path }))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user