parent
379294f164
commit
266e3c7ddb
@ -0,0 +1,21 @@ |
||||
const Through = require('through2') |
||||
|
||||
|
||||
module.exports = { |
||||
jsonParseStream: jsonParseStream, |
||||
jsonStringifyStream: jsonStringifyStream, |
||||
} |
||||
|
||||
function jsonParseStream(){ |
||||
return Through.obj(function(serialized, encoding, cb){ |
||||
this.push(JSON.parse(serialized)) |
||||
cb() |
||||
}) |
||||
} |
||||
|
||||
function jsonStringifyStream(){ |
||||
return Through.obj(function(obj, encoding, cb){ |
||||
this.push(JSON.stringify(obj)) |
||||
cb() |
||||
}) |
||||
} |
Loading…
Reference in new issue