Skip to content

Commit

Permalink
Add actual library
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescostian committed Oct 31, 2014
1 parent c7ce48d commit d9b3574
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit d9b3574

Please sign in to comment.