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

Function test

test/parallel/test-fs-read.js:32–46  ·  view source on GitHub ↗
(bufferAsync, bufferSync, expected)

Source from the content-addressed store, hash-verified

30const expected = Buffer.from('xyz\n');
31
32function test(bufferAsync, bufferSync, expected) {
33 fs.read(fd,
34 bufferAsync,
35 0,
36 expected.length,
37 0,
38 common.mustSucceed((bytesRead) => {
39 assert.strictEqual(bytesRead, expected.length);
40 assert.deepStrictEqual(bufferAsync, expected);
41 }));
42
43 const r = fs.readSync(fd, bufferSync, 0, expected.length, 0);
44 assert.deepStrictEqual(bufferSync, expected);
45 assert.strictEqual(r, expected.length);
46}
47
48test(Buffer.allocUnsafe(expected.length),
49 Buffer.allocUnsafe(expected.length),

Callers 1

test-fs-read.jsFile · 0.70

Calls 2

readMethod · 0.45
readSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…