Home  >  Article  >  Web Front-end  >  What are streams in node.js

What are streams in node.js

一个新手
一个新手Original
2017-09-25 10:26:001396browse


The concept of stream

Official document explanation
1. Stream is an abstract interface implemented by various objects in nodejs.
2. For example, standard input is a stream, and standard output is also a stream.
3. All stream objects are instances of EventEmitter and can emit events.
4. Stream is a data transmission method with a starting point and an end point.

  • The output of the previous one is the input of the next one

  • The output of the previous one is the input of the next one

  • The output of the previous one is the input of the next one

What are streams in node.js

Stream in gulp

  • gulp uses the strategy of flow and code over configuration to simplify task writing as much as possible.

  • Similar to the chain operation in jquery, each method is connected in series to build a complete task.

  • Writing tasks with gulp can also be regarded as writing tasks with Node.js.

  • When using streams, gulp does not need to generate a large number of intermediate files and only writes the final output to disk, making the entire process very fast. .

The above is the detailed content of What are streams in node.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn