Skip to content

Commit

Permalink
http2: allow passing FileHandle to respondWithFD
Browse files Browse the repository at this point in the history
This seems to make sense if we want to promote the use
of `fs.promises`, although it’s not strictly necessary.

PR-URL: nodejs/node#29876
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
addaleax authored and juanarbol committed Dec 17, 2019
1 parent 4a3c5c3 commit f821077
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ server.on('stream', (stream) => {
<!-- YAML
added: v8.4.0
changes:
- version: v12.12.0
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/29876
description: The `fd` option may now be a `FileHandle`.
- version: v10.0.0
Expand Down
54 changes: 29 additions & 25 deletions lib/internal/fs/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,29 +512,33 @@ async function readFile(path, options) {
}

module.exports = {
access,
copyFile,
open,
opendir: promisify(opendir),
rename,
truncate,
rmdir,
mkdir,
readdir,
readlink,
symlink,
lstat,
stat,
link,
unlink,
chmod,
lchmod,
lchown,
chown,
utimes,
realpath,
mkdtemp,
writeFile,
appendFile,
readFile
exports: {
access,
copyFile,
open,
opendir: promisify(opendir),
rename,
truncate,
rmdir,
mkdir,
readdir,
readlink,
symlink,
lstat,
stat,
link,
unlink,
chmod,
lchmod,
lchown,
chown,
utimes,
realpath,
mkdtemp,
writeFile,
appendFile,
readFile,
},

FileHandle
};
6 changes: 1 addition & 5 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ const {
},
hideStackFrames
} = require('internal/errors');
const { validateNumber,
validateString,
validateUint32,
isUint32,
} = require('internal/validators');
const { validateNumber, validateString } = require('internal/validators');
const fsPromisesInternal = require('internal/fs/promises');
const { utcDate } = require('internal/http');
const { onServerStream,
Expand Down

0 comments on commit f821077

Please sign in to comment.