chore(fs/abstract#_outputFile): use readable-stream/finished
This commit is contained in:
parent
d617214c62
commit
f6b73b8303
@ -3,6 +3,7 @@
|
||||
// $FlowFixMe
|
||||
import asyncMap from '@xen-orchestra/async-map'
|
||||
import getStream from 'get-stream'
|
||||
import { finished } from 'readable-stream'
|
||||
import { fromCallback, fromEvent, ignoreErrors, timeout } from 'promise-toolbox'
|
||||
import { parse } from 'xo-remote-parser'
|
||||
import { randomBytes } from 'crypto'
|
||||
@ -104,10 +105,10 @@ export default class RemoteHandlerAbstract {
|
||||
}
|
||||
|
||||
async _outputFile(file: string, data: Data, options?: Object): Promise<void> {
|
||||
const stream = await this.createOutputStream(normalizePath(file), options)
|
||||
const promise = fromEvent(stream, 'finish')
|
||||
const stream = await this.createOutputStream(file, options)
|
||||
const promise = fromCallback(cb => finished(stream))
|
||||
stream.end(data)
|
||||
await promise
|
||||
return promise
|
||||
}
|
||||
|
||||
async read(
|
||||
|
Loading…
Reference in New Issue
Block a user