MCPcopy Index your code
hub / github.com/nodejs/node / oldWay

Function oldWay

benchmark/readline/readline-iterable.js:25–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23Rest of line`;
24
25function oldWay() {
26 const readable = new Readable({
27 objectMode: true,
28 read: () => {
29 this.resume();
30 },
31 destroy: (err, cb) => {
32 this.off('line', lineListener);
33 this.off('close', closeListener);
34 this.close();
35 cb(err);
36 },
37 });
38 const lineListener = (input) => {
39 if (!readable.push(input)) {
40 // TODO(rexagod): drain to resume flow
41 this.pause();
42 }
43 };
44 const closeListener = () => {
45 readable.push(null);
46 };
47 const errorListener = (err) => {
48 readable.destroy(err);
49 };
50 this.on('error', errorListener);
51 this.on('line', lineListener);
52 this.on('close', closeListener);
53 return readable[Symbol.asyncIterator]();
54}
55
56function getLoremIpsumStream(repetitions) {
57 const readable = Readable({

Callers

nothing calls this directly

Calls 5

resumeMethod · 0.65
closeMethod · 0.65
cbFunction · 0.50
offMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…