({ api, compression, filesize, n })
| 28 | }); |
| 29 | |
| 30 | function main({ api, compression, filesize, n }) { |
| 31 | // Create the fixture file with repeating lowercase ASCII |
| 32 | const chunk = Buffer.alloc(Math.min(filesize, 64 * 1024), 'abcdefghij'); |
| 33 | const fd = fs.openSync(filename, 'w'); |
| 34 | let remaining = filesize; |
| 35 | while (remaining > 0) { |
| 36 | const toWrite = Math.min(remaining, chunk.length); |
| 37 | fs.writeSync(fd, chunk, 0, toWrite); |
| 38 | remaining -= toWrite; |
| 39 | } |
| 40 | fs.closeSync(fd); |
| 41 | |
| 42 | if (api === 'classic') { |
| 43 | benchClassic(n, filesize).then(() => cleanup()); |
| 44 | } else if (api === 'webstream') { |
| 45 | benchWebStream(n, filesize).then(() => cleanup()); |
| 46 | } else { |
| 47 | benchPull(n, filesize, compression).then(() => cleanup()); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | function cleanup() { |
| 52 | try { fs.unlinkSync(filename); } catch { /* ignore */ } |
nothing calls this directly
no test coverage detected
searching dependent graphs…