diff --git a/index.js b/index.js new file mode 100644 index 0000000..c68b62a --- /dev/null +++ b/index.js @@ -0,0 +1,15 @@ +'use strict'; +var noop = function () {} + +var streamToString = function (stream, callback) { + var string = '' + stream.on('data', function (data) { + string += data.toString() + }) + stream.on('end', function () { + callback && callback(null, string) + }) + stream.on('error', callback ? callback : noop) +} + +module.exports = require('bluebird').promisify(streamToString)