als-module-info

0.1.1 • Public • Published

als-module-info

The als-module-info is a small function which takes the import.meta object and returns an object with two properties: __dirname and __filename, representing the module's directory and the full path to the module file.

Installation

To install, use npm:

npm install als-module-info

Usage

Import the getModuleInfo function from the package and use it in your ES6 module:

import getModuleInfo from 'als-module-info';

const {__dirname,__filename} = getModuleInfo(import.meta);

console.log(__dirname); // Outputs the directory of the module
console.log(__filename); // Outputs the path to the module file

Package Sidebar

Install

npm i als-module-info

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

1.49 kB

Total Files

3

Last publish

Collaborators

  • alexsorkin