Skip to content

fs: accept URL as argument for `fs.rm` and `fs.rmSync`

Rodrigo Muino Tomonari requested to merge github/fork/aduh95/fix-fs-rm-url into master

if we pass the URL instead of string path we get:

Exception has occurred: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of URL
  at new NodeError (node:internal/errors:371:5)
    at Function.from (node:buffer:322:9)
    at _rmdirSync (node:internal/fs/rimraf:248:30)
    at rimrafSync (node:internal/fs/rimraf:193:7)
    at Module.rmSync (node:fs:1214:10)

Originally posted by @dygabo in https://github.com/nodejs/node/pull/40980#discussion_r766395639

Merge request reports

Loading