Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 399 Bytes

readme.md

File metadata and controls

23 lines (14 loc) · 399 Bytes

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