feat(remote-handlers): cannot overwrite files by default (#297)

This commit is contained in:
ABHAMON Ronan 2016-05-03 16:56:26 +02:00 committed by Julien Fontanet
parent a2ed388777
commit c198350bfa

View File

@ -48,11 +48,14 @@ export default class RemoteHandlerAbstract {
}
async outputFile (file, data, options) {
return this._outputFile(file, data, options)
return this._outputFile(file, data, {
flags: 'wx',
...options
})
}
async _outputFile (file, data, options) {
const stream = await this.createOutputStream(file)
const stream = await this.createOutputStream(file, options)
const promise = eventToPromise(stream, 'finish')
stream.end(data)
return promise
@ -128,7 +131,10 @@ export default class RemoteHandlerAbstract {
checksum = false,
...options
} = {}) {
const streamP = this._createOutputStream(file, options)
const streamP = this._createOutputStream(file, {
flags: 'wx',
...options
})
if (!checksum) {
return streamP