kol-93 / expat-stream Goto Github PK
View Code? Open in Web Editor NEWXML stream processor implemented using expat parser
XML stream processor implemented using expat parser
here is my code:
function readByXML(_path, callback) {
const input = fs.createReadStream(_path, { encoding: "utf16le" });
const xmlStream = new XMLStream({
write(info) {
console.log(info);
return info.level === 1;
},
keep(info) {
console.log(info.level);
return info.level > 1;
},
});
xmlStream.on("data", data => {
console.log(data);
callback(data);
});
input.pipe(xmlStream);
}
here is the error:
trans error: TypeError: stream.pipe is not a function
at new _XMLStream (./db_migration/node_modules/expat-stream/distribution/core/xml.stream.js:110:16)
at readByXML (./db_migration/trans_json/filesys.js:11:21)
at read (./db_migration/trans_json/filesys.js:79:3)
at ./db_migration/trans_json/index.js:32:7
at processTicksAndRejections (internal/process/task_queues.js:97:5)
here is your constructor:
export declare const XMLStream: {
new (stream: NodeJS.ReadableStream): IXMLStream;
};
here is my question:
What's the point of your wrong example?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.