Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Fixed config.replace #634

Merged
merged 3 commits into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/config/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

const streamifier = require('streamifier')
const promisify = require('promisify-es6')
const SendOneFile = require('../utils/send-one-file')

module.exports = (send) => {
const sendOneFile = SendOneFile(send, 'config/replace')
return promisify((config, callback) => {
if (typeof config === 'object') {
config = streamifier.createReadStream(Buffer.from(JSON.stringify(config)))
}

send({
path: 'config/replace',
files: config,
buffer: true
}, callback)
sendOneFile(config, {}, callback)
})
}
3 changes: 0 additions & 3 deletions src/utils/send-one-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ module.exports = (send, path) => {
if (err) {
return callback(err)
}
if (results.length !== 1) {
return callback(new Error('expected 1 result and had ' + results.length))
}
callback(null, results[0])
})
}
Expand Down