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

Function runClassic

benchmark/fs/bench-filehandle-pull-vs-webstream.js:79–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77}
78
79function runClassic() {
80 return new Promise((resolve, reject) => {
81 const rs = fs.createReadStream(filename);
82
83 const upper = new Transform({
84 transform(chunk, encoding, callback) {
85 callback(null, uppercaseChunk(chunk));
86 },
87 });
88
89 const gz = zlib.createGzip();
90
91 let totalBytes = 0;
92 const sink = new Writable({
93 write(chunk, encoding, callback) {
94 totalBytes += chunk.length;
95 callback();
96 },
97 });
98
99 pipeline(rs, upper, gz, sink, (err) => {
100 if (err) reject(err);
101 else resolve(totalBytes);
102 });
103 });
104}
105
106// ---------------------------------------------------------------------------
107// WebStream path: readableWebStream -> TransformStream (upper) -> CompressionStream

Callers 1

benchClassicFunction · 0.85

Calls 4

pipelineFunction · 0.50
rejectFunction · 0.50
resolveFunction · 0.50
createReadStreamMethod · 0.45

Tested by

no test coverage detected