summaryrefslogtreecommitdiff
path: root/lib/fs.js
Commit message (Collapse)AuthorAgeFilesLines
* fs: make readdir recursive algorithm iterativeEthan Arrowood2023-05-101-30/+58
| | | | | | PR-URL: https://github.com/nodejs/node/pull/47650 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
* fs: add recursive option to readdir and opendirEthan Arrowood2023-04-201-0/+47
| | | | | | | | | | | | | Adds a naive, linear recursive algorithm for the following methods: readdir, readdirSync, opendir, opendirSync, and the promise based equivalents. Fixes: https://github.com/nodejs/node/issues/34992 PR-URL: https://github.com/nodejs/node/pull/41439 Refs: https://github.com/nodejs/tooling/issues/130 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
* src: make AliasedBuffers in the binding data weakJoyee Cheung2023-04-201-8/+8
| | | | | | | | | | | | | | The binding data holds references to the AliasedBuffers directly from their wrappers which already ensures that the AliasedBuffers won't be accessed when the wrappers are GC'ed. So we can just make the global references to the AliasedBuffers weak. This way we can simply deserialize the typed arrays when deserialize the binding data and avoid the extra Object::Set() calls. It also eliminates the caveat in the JS land where aliased buffers must be dynamically read from the binding. PR-URL: https://github.com/nodejs/node/pull/47354 Refs: https://github.com/nodejs/node/issues/47353 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
* src,process: add permission modelRafael Gonzaga2023-02-231-2/+4
| | | | | | | | | | Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/44004 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* fs: add trailing commas in source filesAntoine du Hamel2023-02-201-9/+9
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/46696 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: James M Snell <jasnell@gmail.com>
* src, lib: fixup lint and format issues for DataQueue/BlobJames M Snell2023-02-191-0/+19
| | | | | | Co-authored-by: flakey5 <73616808+flakey5@users.noreply.github.com> PR-URL: https://github.com/nodejs/node/pull/45258 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* lib: enforce use of trailing commas for functionsAntoine du Hamel2023-02-141-1/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/46629 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
* fs: add statfs() functionsColin Ihrig2023-01-291-0/+30
| | | | | | | | | | | This commit adds statfs() and statfsSync() to the fs module, and statfs() to the fsPromises module. Co-authored-by: cjihrig <cjihrig@gmail.com> Fixes: https://github.com/nodejs/node/issues/10745 Refs: https://github.com/nodejs/node/pull/31351 PR-URL: https://github.com/nodejs/node/pull/46358 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* bootstrap: lazy load non-essential modulesJoyee Cheung2022-12-091-15/+12
| | | | | | | | | | | | | | | | | | | | | It turns out that even with startup snapshots, there is a non-trivial overhead for loading internal modules. This patch makes the loading of the non-essential modules lazy again. Caveat: we have to make some of the globals lazily-loaded too, so the WPT runner is updated to test what the state of the global scope is after the globals are accessed (and replaced with the loaded value). PR-URL: https://github.com/nodejs/node/pull/45659 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
* fs: update todo messageYagiz Nizipli2022-11-011-1/+1
| | | | | | PR-URL: https://github.com/nodejs/node/pull/45265 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
* fs: add recursive watch to linuxYagiz Nizipli2022-10-311-9/+17
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/45098 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* fs: improve promise based readFile performance for big filesRuben Bridgewater2022-10-061-0/+5
| | | | | | | | | | This significantly reduces the peak memory for the promise based readFile operation by reusing a single memory chunk after each read and strinigifying that chunk immediately. Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> PR-URL: https://github.com/nodejs/node/pull/44295 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* fs: add validateBuffer to improve errorHirotaka Tagawa / wafuwafu132022-09-281-1/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/44769 Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* fs: remove unused option in `fs.fstatSync()`Livia Medeiros2022-09-141-2/+1
| | | | | | PR-URL: https://github.com/nodejs/node/pull/44613 Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: theanarkh <theratliter@gmail.com>
* src: make ReqWrap weakRafael Gonzaga2022-09-141-4/+0
| | | | | | | | This commit allows throwing an exception after creating `FSReqCallback` Co-authored-by: Anna Henningsen <anna@addaleax.net> PR-URL: https://github.com/nodejs/node/pull/44074 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* win: fix fs.realpath.native for long pathsStefanStojanovic2022-09-131-2/+2
| | | | | | | | | | | | Unlike other fs.js functions that work with paths, realpath.native isn't using pathModule.toNamespacedPath prior to calling libuv function. This is causing issues on windows. Windows long path test is also improved to cover the mentioned issue. Fixes: https://github.com/nodejs/node/issues/39721 PR-URL: https://github.com/nodejs/node/pull/44536 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
* fs: remove coercion to string in writing methodsLivia Medeiros2022-09-121-24/+7
| | | | | | | | Moves DEP0162 to End-of-Life. PR-URL: https://github.com/nodejs/node/pull/42796 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* fs: harden fs.readSync(buffer, options) typecheckLiviaMedeiros2022-09-111-7/+9
| | | | | | | Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: https://github.com/nodejs/node/pull/42772 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* fs: harden fs.read(params, callback) typecheckLiviaMedeiros2022-09-111-0/+3
| | | | | | PR-URL: https://github.com/nodejs/node/pull/42772 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* lib: reset `RegExp` statics before running user codeAntoine du Hamel2022-08-051-2/+2
| | | | | | | | Fixes: https://github.com/nodejs/node/issues/43740 PR-URL: https://github.com/nodejs/node/pull/43741 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* fs: refactor realpath with Map and SetLivia Medeiros2022-06-301-22/+22
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/43569 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* fs: use `kEmptyObject`LiviaMedeiros2022-06-111-28/+33
| | | | | | PR-URL: https://github.com/nodejs/node/pull/43159 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* lib: give names to promisified methodsLiviaMedeiros2022-06-051-2/+2
| | | | | | | | Affected functions: `fs.exists`, `readline.Interface.prototype.question` PR-URL: https://github.com/nodejs/node/pull/43218 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
* lib: use null-prototype objects for property descriptorsAntoine du Hamel2022-06-031-7/+11
| | | | | | | | | Refs: https://github.com/nodejs/node/pull/42921 PR-URL: https://github.com/nodejs/node/pull/43270 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
* fs: add trailing commasLiviaMedeiros2022-05-181-1/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/43127 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
* fs: make params in writing methods optionalLiviaMedeiros2022-05-181-8/+29
| | | | | | | | | | | | | | This change allows passing objects as "named parameters": - `fs.write(fd, buffer[, options], callback)` - `fs.writeSync(fd, buffer[, options])` - `filehandle.write(buffer[, options])` Fixes: https://github.com/nodejs/node/issues/41666 PR-URL: https://github.com/nodejs/node/pull/42601 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* fs: add `read(buffer[, options])` versionsLivia Medeiros2022-05-021-15/+22
| | | | | | | | | This adds the following: - `fs.read(fd, buffer[, options], callback)`. - `filehandle.read(buffer[, options])`. PR-URL: https://github.com/nodejs/node/pull/42768 Refs: https://github.com/nodejs/node/pull/42601 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* doc: clarify some default values in `fs.md`Livia Medeiros2022-05-021-10/+10
| | | | | PR-URL: https://github.com/nodejs/node/pull/42892 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
* doc: consolidate use of multiple-byte unitsAntoine du Hamel2022-04-201-1/+1
| | | | | | | | | | Refs: https://en.wikipedia.org/wiki/Byte#Multiple-byte_units PR-URL: https://github.com/nodejs/node/pull/42587 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com>
* fs: runtime deprecate string coercion in `fs.write`, `fs.writeFileSync`Livia Medeiros2022-04-081-0/+14
| | | | | | | | | This also affects `fs.writeFile`, `fs.appendFile`, and `fs.appendFileSync` PR-URL: https://github.com/nodejs/node/pull/42607 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* fs: fix write methods param validation and docsLivia Medeiros2022-04-041-2/+3
| | | | | | | | | | | | | | | | The FS docs wrongfully indicated support for passing object with an own `toString` function property to `FileHandle.prototype.appendFile`, `FileHandle.prototype.writeFile`, `FileHandle.prototype.write`, `fsPromises.writeFile`, and `fs.writeSync`. This commit fixes that, and adds some test to ensure the actual behavior is aligned with the docs. It also fixes a bug that makes the process crash if a non-buffer object was passed to `FileHandle.prototype.write`. Refs: https://github.com/nodejs/node/pull/34993 PR-URL: https://github.com/nodejs/node/pull/41677 Refs: https://github.com/nodejs/node/issues/41666 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* lib: update JSDoc for lintingRich Trott2022-03-271-2/+2
| | | | | | | | | | | | Fix issue that will be flagged when we update ESLint and dependencies. PR-URL: https://github.com/nodejs/node/pull/42489 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* fs: adjust default `length` for `fs.readSync` and fsPromises/`read`Livia Medeiros2022-02-271-5/+9
| | | | | | | Makes default length reasonable when nonzero offset is set. PR-URL: https://github.com/nodejs/node/pull/42128 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* fs: fix default `length` parameter for `fs.read`wbt2022-02-191-1/+1
| | | | | | | | | | | | Currently, specifying an `offset` without a `length` throws an `ERR_OUT_OF_RANGE` error. This commit provides a more sensible default. This change should only affect cases where no length is specified and a nonzero offset is, which are currently throwing errors. PR-URL: https://github.com/nodejs/node/pull/40349 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* fs: fix cb/sync writev empty array behaviorBenjamin Gruenbaum2022-02-141-0/+9
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/41932 Refs: https://github.com/nodejs/node/issues/41910 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* fs: refactor to use ES2020 syntax小菜2022-02-111-3/+2
| | | | | PR-URL: https://github.com/nodejs/node/pull/41903 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* lib: replace validator and errorMohammed Keyvanzadeh2022-02-051-4/+3
| | | | | | | | | | Refs: https://github.com/nodejs/node/pull/41660 PR-URL: https://github.com/nodejs/node/pull/41678 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* lib: add comments to empty catch statementsRich Trott2022-02-051-1/+3
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/41831 Refs: https://eslint.org/docs/rules/no-empty Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
* fs: correct param names in JSDoc commentsRich Trott2021-12-211-2/+2
| | | | | | PR-URL: https://github.com/nodejs/node/pull/41237 Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* fs: accept URL as argument for `fs.rm` and `fs.rmSync`Antoine du Hamel2021-12-131-0/+2
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/41132 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* lib: use consistent types in JSDoc @returnsRich Trott2021-12-071-1/+1
| | | | | | PR-URL: https://github.com/nodejs/node/pull/41089 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* fs: propagate abortsignal reason in new AbortSignal constructorsJames M Snell2021-12-021-2/+2
| | | | | | | | | Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/41008 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* lib,test,tools: use consistent JSDoc typesRich Trott2021-11-291-6/+6
| | | | | | | | | | | | This could be in preparation of implementing the jsdoc/check-types ESLint rule. PR-URL: https://github.com/nodejs/node/pull/40989 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* fs: add recursive cp methodbcoe2021-08-111-0/+50
| | | | | | | | | | | | | Introduces recursive cp method, based on fs-extra implementation. PR-URL: https://github.com/nodejs/node/pull/39372 Fixes: https://github.com/nodejs/node/issues/35880 Refs: https://github.com/nodejs/tooling/issues/98 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ian Sutherland <ian@iansutherland.ca>
* fs: allow empty string for temp directory prefixVoltrex2021-06-261-7/+5
| | | | | | | | | | | | | The `fs` lib module's `mkdtemp()` and `mkdtempSync()` methods were missing a validator, and weren't allowing the empty string as a valid prefix. PR-URL: https://github.com/nodejs/node/pull/39028 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe>
* lib: load internal/fs/watchers and internal/fs/read_file_context earlyJoyee Cheung2021-05-271-8/+3
| | | | | | | | So that they are included in the builtin snapshot PR-URL: https://github.com/nodejs/node/pull/38737 Refs: https://github.com/nodejs/node/issues/35711 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* src: fix validation of negative offset to avoid abortJames M Snell2021-04-281-4/+4
| | | | | | | | | | Fixes: https://github.com/nodejs/node/issues/24640 Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/38421 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Nitzan Uziely <linkgoron@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
* typings: add JSDoc typings for fsVoltrex2021-04-271-26/+771
| | | | | | | | | | Added JSDoc typings for the `fs` lib module. PR-URL: https://github.com/nodejs/node/pull/38306 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
* fs: use byteLength to handle ArrayBuffer viewsMichaël Zasso2021-04-121-5/+5
| | | | | | | | | | Unlike TypedArray, DataView doesn't have a length property. PR-URL: https://github.com/nodejs/node/pull/38187 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
* fs: validate encoding to binding.writeString()cjihrig2021-04-111-1/+6
| | | | | | | | | | | | | The binding layer performs some validation of the encoding and data passed to WriteString(). This commit adds similar validation to the JS layer for better error handling. PR-URL: https://github.com/nodejs/node/pull/38183 Fixes: https://github.com/nodejs/node/issues/38168 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>