A dead simple way to get the Deno equivalent of dirname
path
and filename
.
You can get this package from denopkg or from deno.land/x or from nest.land.
import dirname from "https://x.nest.land/denoname@0.8.2/mod/dirname.ts";
import path from "https://x.nest.land/denoname@0.8.2/mod/path.ts";
import filename from "https://x.nest.land/denoname@0.8.2/mod/filename.ts";
const __dirname = dirname(import.meta);
const __path = path(import.meta);
const __filename = filename(import.meta);
You can also generate both of them in one go!
import generate from "https://x.nest.land/denoname@0.8.2/mod.ts";
const { dirname, path, filename } = generate(import.meta);
Author: shadowtime2000
Demo: https://nest.land/package/denoname
Source Code: https://github.com/shadowtime2000/denoname
#deno #nodejs #javascript #node