-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs: support util.promisify for fs.readv
PR-URL: #33590 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
- Loading branch information
1 parent
a437a84
commit 8e080c1
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const fixtures = require('../common/fixtures'); | ||
const fs = require('fs'); | ||
const readv = require('util').promisify(fs.readv); | ||
const assert = require('assert'); | ||
const filepath = fixtures.path('x.txt'); | ||
const fd = fs.openSync(filepath, 'r'); | ||
|
||
const expected = [Buffer.from('xyz\n')]; | ||
|
||
readv(fd, expected) | ||
.then(function({ bytesRead, buffers }) { | ||
assert.deepStrictEqual(bytesRead, expected[0].length); | ||
assert.deepStrictEqual(buffers, expected); | ||
}) | ||
.then(common.mustCall()); |