fs: accept URL as argument for `fs.rm` and `fs.rmSync` · nodejs/node@b671194 · GitHub
Skip to content

Commit b671194

Browse files
aduh95danielleadams
authored andcommitted
fs: accept URL as argument for fs.rm and fs.rmSync
PR-URL: #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> Backport-PR-URL: #41752 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Danielle Adams <adamzdanielle@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
1 parent 99a90db commit b671194

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

doc/api/fs.md

Lines changed: 10 additions & 0 deletions

lib/fs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,7 @@ function rm(path, options, callback) {
11851185
callback = options;
11861186
options = undefined;
11871187
}
1188+
path = getValidatedPath(path);
11881189

11891190
validateRmOptions(path, options, false, (err, options) => {
11901191
if (err) {
@@ -1208,6 +1209,7 @@ function rm(path, options, callback) {
12081209
* @returns {void}
12091210
*/
12101211
function rmSync(path, options) {
1212+
path = getValidatedPath(path);
12111213
options = validateRmOptionsSync(path, options, false);
12121214

12131215
lazyLoadRimraf();

test/parallel/test-fs-rm.js

Lines changed: 27 additions & 0 deletions

0 commit comments

Comments
 (0)