Skip to content
/ desm Public
forked from mcollina/desm

get the file directory from import.meta.url

License

Notifications You must be signed in to change notification settings

voxpelli/desm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

desm

The missing one-liner utility to get the dirname from import.meta.url.

Requires Node 12.17.0 or Node 14.0.0.

Install

npm i desm

Usage

import desm from 'desm'

console.log(desm(import.meta.url))

or

import { dirname, filename, join } from 'desm'

// same as CommonJS __dirname
console.log(dirname(import.meta.url))

// same as CommonJS __filename
console.log(filename(import.meta.url))

// same as CommonJS path.join(__dirname, 'routes')
console.log(join(import.meta.url, 'routes'))

// same as CommonJS path.join(__dirname, '..', 'other')
console.log(join(import.meta.url, '..', 'other'))

License

MIT

About

get the file directory from import.meta.url

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • JavaScript 100.0%