zoubin / streamify-your-node-program Goto Github PK
View Code? Open in Web Editor NEW对Node.js中 stream模块的学习积累和理解
License: MIT License
对Node.js中 stream模块的学习积累和理解
License: MIT License
不管是知乎还是美团技术团队官方博客,都加载不出文章插图了。麻烦修复一下。
谢谢
如题,有处理几百M甚至上G的大 JSON 需求,看到这个系列,很详细的看完了,确实写的很不错
不知道你们有没有这样的思路~
在《基础篇》,有这样的一个示例代码:
...
class ToReadable extends Readable {
constructor(iterable) {
super()
this.iterator = new function *() {
yield * iterable
}
}
...
对Generator使用new
,在node 4.x.x 没报错,但是在node 6.1.0下会报TypeError: (intermediate value) is not a constructor
。
我觉得,应该严谨些,不用那些Generator让人疑惑的用法,可能会给读者更清晰的体验。
在node.9.5.0的中doWrite()
的部分源码如下
if (writev)//_writev是批量写入数据,如果有就优先调用之
stream._writev(chunk, state.onwrite);
else//否则调用默认的版本
stream._write(chunk, encoding, state.onwrite);
state.sync = false;
_write
和_writev
的回调已经不叫next
了,建议文章也同步修改一下
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.