loading...
Cover image for denoname

denoname

shadowtime2000 profile image shadowtime2000 Updated on ・1 min read

GitHub logo shadowtime2000 / denoname

A dead simple way to get the Deno equivalent way of dirname and filename.

denoname

A dead simple way to get the Deno equivalent way of dirname path and filename.

CDN

You can get this package from denopkg or from deno.land/x.

Usage

import dirname from "https://deno.land/x/denoname/mod/dirname.ts";
import path from "https://deno.land/x/denoname/mod/path.ts";
import filename from "https://deno.land/x/denoname/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://deno.land/x/denoname/mod.ts";

const { dirname, path, filename } = generate(import.meta);





I was playing around with Deno and I couldn't figure out a way to simply get the equivalent of __dirname and other global variables like that that are available in NodeJS. So I created a Deno library.

denoname

A dead simple way to get the Deno equivalent way of dirname and filename.

CDN

You can get this package from a raw Github CDN or from deno.land/x.

Usage

import dirname from "https://deno.land/x/denoname/mod/dirname.ts";
import path from "https://deno.land/x/denoname/mod/path.ts";
import filename from "https://deno.land/x/denoname/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://deno.land/x/denoname/mod.ts";

const { dirname, path, filename } = generate(import.meta);

This package is completely free of dependencies as of v0.6.0.

Contributing

Feel free to just open a pull request with your changes to contribute!

Links

Github
deno.land/x

Please star the repository to help support it.

Discussion

pic
Editor guide