You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_stream_readable.js:476
dest.on('unpipe', onunpipe);
^
TypeError: Object #<Parser> has no method 'on'
at ReadStream.Readable.pipe (_stream_readable.js:476:8)
at Object.<anonymous> (C:\dev\autorelease\script.js:54:8)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Here is my simple script:
// get a file stream reader
var reader = fs.createReadStream(process.argv[2]);
// get a file stream writer pointing to the json file to write to
var writer = fs.createWriteStream(input_json);
var htmlparser = require("htmlparser");
//var rawHtml = "Xyz <script language= javascript>var foo = '<<bar>>';< / script><!--<!-- Waah! -- -->";
//var sys = require("sys");
var handler = new htmlparser.DefaultHandler(function (error, dom) {
if (error)
logger.log('error', 'handler error in parser', {error: error});
else
logger.log('info', '', {dom: JSON.stringify(dom)});
});
var parser = new htmlparser.Parser(handler);
//parser.parseComplete(reader);
//sys.puts(sys.inspect(handler.dom, false, null));
// pipe everything to do the conversion
reader.pipe(parser).pipe(writer);
The text was updated successfully, but these errors were encountered:
Can you share an example of a working script using Streaming To Parser in Node?
Using your README text generates an error.
I get this error in console:
Here is my simple script:
The text was updated successfully, but these errors were encountered: