I would like to be able to do something like that:
await Deno.open(new URL('../relative/path.txt', import.meta.url));
Currently this fails the TypeScript type checking, and even when bypassing it, it throws a NotFound: No such file or directory (os error 2) error.
FWIW Node.js fs module methods support it, and IMO it would be a neat addition to Deno.
in case of support for accepting URL type argument in fs methods, it should be an easy fix if Deno decides to have.
I think @marcosc90 is working on it as stated in this comment.
_However, it is now available with fromFileUrl function from path module._
import { fromFileUrl } from "http://deno.land/[email protected]/path/mod.ts";
await Deno.open(fromFileUrl(new URL("../relative/path.txt", import.meta.url)));
I'm currently working on https://github.com/denoland/deno/issues/4877 so I don't mind if someone else picks it up.
I'm all for it. We should be using URLs as much as possible.
I'm pretty green but I'd like to give this a shot
Most helpful comment
in case of support for accepting URL type argument in fs methods, it should be an easy fix if Deno decides to have.
I think @marcosc90 is working on it as stated in this comment.
_However, it is now available with
fromFileUrlfunction from path module._