From 266e3c7ddb920c933355d559144bab6c633a65fb Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 8 Apr 2016 14:24:10 -0700 Subject: popup - fix web3 plumbing --- app/scripts/lib/stream-utils.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/scripts/lib/stream-utils.js (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/stream-utils.js b/app/scripts/lib/stream-utils.js new file mode 100644 index 000000000..12560ffd8 --- /dev/null +++ b/app/scripts/lib/stream-utils.js @@ -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() + }) +} -- cgit v1.2.3