mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-11 22:06:36 +10:00
13 lines
263 B
JavaScript
13 lines
263 B
JavaScript
|
|
module.exports = function(res, fn){
|
|
res.text = '';
|
|
res.setEncoding('utf8');
|
|
res.on('data', function(chunk){ res.text += chunk; });
|
|
res.on('end', function(){
|
|
try {
|
|
fn(null, JSON.parse(res.text));
|
|
} catch (err) {
|
|
fn(err);
|
|
}
|
|
});
|
|
}; |