()
| 284 | // ============================================================================= |
| 285 | |
| 286 | async function testWritev() { |
| 287 | const chunks = []; |
| 288 | const writable = new Writable({ |
| 289 | highWaterMark: 1024, |
| 290 | write(chunk, encoding, cb) { |
| 291 | chunks.push(Buffer.from(chunk)); |
| 292 | cb(); |
| 293 | }, |
| 294 | writev(entries, cb) { |
| 295 | for (const { chunk } of entries) { |
| 296 | chunks.push(Buffer.from(chunk)); |
| 297 | } |
| 298 | cb(); |
| 299 | }, |
| 300 | }); |
| 301 | |
| 302 | const writer = fromWritable(writable, { backpressure: 'block' }); |
| 303 | await writer.writev([ |
| 304 | new TextEncoder().encode('hello'), |
| 305 | new TextEncoder().encode(' '), |
| 306 | new TextEncoder().encode('world'), |
| 307 | ]); |
| 308 | await writer.end(); |
| 309 | |
| 310 | assert.strictEqual(Buffer.concat(chunks).toString(), 'hello world'); |
| 311 | } |
| 312 | |
| 313 | // ============================================================================= |
| 314 | // writeSync / writevSync always return false |
no test coverage detected