Skip to content

Node.js module that returns the current script dirname (esm support)

Notifications You must be signed in to change notification settings

vdegenne/es-dirname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

es-dirname

Node.js module that returns the current script dirname. Similar to __dirname but also works in ES modules.

Installation

yarn add es-dirname

Usage

/path/to/the/script.mjs

import dirname from 'es-dirname'

console.log(dirname()) // outputs "/path/to/the"

CommonJs

console.log(require('es-dirname')() === __dirname) // true

About

Node.js module that returns the current script dirname (esm support)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published