# als-module-info

> A utility for easy retrieval of __dirname and __filename in Node.js ES6 modules.

Latest version **0.1.1** (published 2023-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install als-module-info
pnpm add als-module-info
yarn add als-module-info
bun add als-module-info
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-10-27 |
| First published | 2023-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alex Sorkin |
| Maintainers | alexsorkin |
| Keywords | __dirname, __filename, dirname, filename, module, path, ES6, nodejs, esm, import.meta |

## Links

- npm: https://www.npmjs.com/package/als-module-info
- npm.io page: https://npm.io/package/als-module-info

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2023-10-27
- 0.1.0 — 2023-10-27

## README

# 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:

```bash
npm install als-module-info
```

## Usage

Import the `getModuleInfo` function from the package and use it in your ES6 module:

```javascript
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
```

---
_Source: https://npm.io/package/als-module-info · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
