fs: use a default callback for fs.close() · nodejs/node@655d196 · GitHub
Skip to content

Commit 655d196

Browse files
jasnelldanielleadams
authored andcommitted
fs: use a default callback for fs.close()
The `fs.close()` function requires a callback. Most often the only thing that callback does is check and rethrow the error if one occurs. To eliminate common boilerplate, make the callback optional with a default that checks and rethrows the error as an uncaught exception. Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #37174 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 66a14d3 commit 655d196

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

doc/api/fs.md

Lines changed: 7 additions & 1 deletion

lib/fs.js

Lines changed: 7 additions & 2 deletions

0 commit comments

Comments
 (0)