G
G
gleendo2017-07-30 05:40:09
Node.js
gleendo, 2017-07-30 05:40:09

What is getReadableStreamSomehow()?

The book has an example:

let fs = require("fs");

let stream = fs.createReadStream("file.txt"); // ~400kb
let readable = getReadableStreamSomehow();

stream.on("data", chunk => {
  console.log(`got ${chunk.length} bytes of data`);

  stream.pause();

  console.log("There will be no more data for 10 second");

  setTimeout(() => {
    console.log("Now data will start again");

    stream.resume();
  }, 10000);
})

But an error occurs that getReadableStreamSomehow is not found. The documentation also uses this function in some examples. Where is she from and why? What is it all about. The example declares a readable variable but doesn't use it...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question