Skip to content

Instantly share code, notes, and snippets.

View jonsullivan's full-sized avatar

Jon Sullivan jonsullivan

View GitHub Profile
var hyperquest = require('hyperquest');
module.exports = function downloadUtf8FileIntoString(url, cb) {
if (!url) return cb(new Error('url is required'));
var result = ''; // fixed scope
hyperquest(url)
.pipe(function (chunk, enc, tCb) {
result += chunk.toString('utf8'); // binary to utf8
tCb();
})