Like import.meta.resolve("./bla/bla") but so that it return me the relative cwd path
How using Deno to do something like import.meta.resolve("./bla/bla") but so that it return me the relative path relative to the current working directory ?
3 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on your message, it seems like you're looking for a way to resolve a path relative to the current working directory (CWD) in Deno.
In Deno, you can use
Deno.cwd()
to get the current working directory and then use the path
module from Deno's standard library to resolve or join paths. Here's an example of how you might achieve this:
This will give you an absolute path, not a relative one. If you need a relative path, you could potentially calculate it by comparing the absolute path to the CWD, but this functionality is not directly provided by Deno's standard library.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice and test it to ensure it meets your requirements.@NestarZ you can call
import.meta.resolve()
to get the full path, then use relative()
from @std/path
to make it relative to Deno.cwd()
thank you @lucacasonato