Dev Helpers
← Back

Decode a file URL to a path

Decode a file URL to a path using Node.js.

Open this example in the interactive library

Source code

import {
  URL,
  domainToASCII,
  domainToUnicode,
  pathToFileURL,
  fileURLToPath,
} from "node:url";
console.log(fileURLToPath("file:///tmp/report%20one.txt", { windows: false }));

Sample output

/tmp/report one.txt