v0.2.0
Implementation of Node's __dirname and __filename for Deno
Repository
Current version released
3 years ago
Dependencies
nest.land
Versions
Usage
Get the current dirname and filename:
Method 1
/* main.ts */
import { fromMeta } from "https://x.nest.land/dirname_deno@0.2.0/mod.ts";
const { __dirname, __filename } = fromMeta(import.meta);
console.log(__dirname); // /home/you/projects/project/src
console.log(__filename); // /home/you/projects/project/src/main.ts
Method 2
/* main.ts */
import { getDirname, getFilename } from "https://x.nest.land/dirname_deno@0.2.0/mod.ts";
const dirname = getDirname(import.meta);
console.log(dirname); // /home/you/projects/project/src
const filename = getFilename(import.meta);
console.log(filename); // /home/you/projects/project/src/main.ts