MCPcopy Create free account
hub / github.com/nodejs/node / testBasicWritev

Function testBasicWritev

test/parallel/test-fs-promises-file-handle-writer.js:42–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40// =============================================================================
41
42async function testBasicWritev() {
43 const filePath = path.join(tmpDir, 'writer-writev.txt');
44 const fh = await open(filePath, 'w');
45 const w = fh.writer();
46 await w.writev([
47 Buffer.from('aaa'),
48 Buffer.from('bbb'),
49 Buffer.from('ccc'),
50 ]);
51 const totalBytes = await w.end();
52 await fh.close();
53
54 assert.strictEqual(totalBytes, 9);
55 assert.strictEqual(fs.readFileSync(filePath, 'utf8'), 'aaabbbccc');
56}
57
58// =============================================================================
59// Mixed write() and writev()

Calls 8

writerMethod · 0.80
openFunction · 0.70
closeMethod · 0.65
joinMethod · 0.45
writevMethod · 0.45
fromMethod · 0.45
endMethod · 0.45
readFileSyncMethod · 0.45

Tested by

no test coverage detected