(filesize, highWaterMark, encoding, n)
| 67 | } |
| 68 | |
| 69 | function runTest(filesize, highWaterMark, encoding, n) { |
| 70 | assert.strictEqual(fs.statSync(filename).size, filesize * n); |
| 71 | const rs = fs.createReadStream(filename, { |
| 72 | highWaterMark, |
| 73 | encoding, |
| 74 | }); |
| 75 | |
| 76 | rs.on('open', () => { |
| 77 | bench.start(); |
| 78 | }); |
| 79 | |
| 80 | let bytes = 0; |
| 81 | rs.on('data', (chunk) => { |
| 82 | bytes += chunk.length; |
| 83 | }); |
| 84 | |
| 85 | rs.on('end', () => { |
| 86 | try { |
| 87 | fs.unlinkSync(filename); |
| 88 | } catch { |
| 89 | // Continue regardless of error. |
| 90 | } |
| 91 | // MB/sec |
| 92 | bench.end(bytes / (1024 * 1024)); |
| 93 | }); |
| 94 | } |
nothing calls this directly
no test coverage detected