# heimdalljs-fs-monitor

> fs operation monitoring for heimdalljs

Latest version **1.1.2** (published 2025-08-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install heimdalljs-fs-monitor
pnpm add heimdalljs-fs-monitor
yarn add heimdalljs-fs-monitor
bun add heimdalljs-fs-monitor
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities; has provenance.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2025-08-26 |
| First published | 2016-08-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Maintainers | hjdivad, rwjblue, katiegengler, stefanpenner, gabrielcsapo |

## Links

- npm: https://www.npmjs.com/package/heimdalljs-fs-monitor
- Repository: https://github.com/ember-cli/heimdall-fs-monitor
- Homepage: https://github.com/ember-cli/heimdall-fs-monitor#readme
- Issues: https://github.com/ember-cli/heimdall-fs-monitor/issues
- npm.io page: https://npm.io/package/heimdalljs-fs-monitor

## Dependencies (5)

- [callsites](https://npm.io/package/callsites.md) ^3.1.0
- [heimdalljs](https://npm.io/package/heimdalljs.md) ^0.2.3
- [clean-stack](https://npm.io/package/clean-stack.md) ^2.2.0
- [extract-stack](https://npm.io/package/extract-stack.md) ^2.0.0
- [heimdalljs-logger](https://npm.io/package/heimdalljs-logger.md) ^0.1.7

## Recent versions

- 1.1.2 (latest) — 2025-08-26
- 1.1.1 — 2021-09-29
- 1.1.0 — 2020-06-23
- 0.2.3 — 2019-08-19
- 0.2.2 — 2018-08-02
- 0.2.1 — 2018-05-14
- 0.1.1 — 2018-04-12
- 0.2.0 — 2017-12-12
- 0.1.0 — 2016-11-21
- 0.0.4 — 2016-11-21
- 0.0.3 — 2016-08-09
- 0.0.2 — 2016-08-02
- 0.0.1 — 2016-08-02

## README

# heimdall-fs-monitor

[![npm](https://img.shields.io/npm/v/heimdalljs-fs-monitor.svg)](https://www.npmjs.com/package/heimdalljs-fs-monitor)

file system monitor plugin for [heimdalljs](https://github.com/heimdalljs/heimdalljs-lib)

> [!Note]
> This has been forked from the archived repo https://github.com/heimdalljs/heimdall-fs-monitor to fix an issue with Node 24


## Installation

```
npm install --save-dev heimdalljs-fs-monitor
```

## Usage

```js
const FSMonitor = require('heimdalljs-fs-monitor');

// create a new file system monitor
const monitor = new FSMonitor();

// start monitoring
monitor.start();

// ... do some file system work ...
var fs = require('fs');
fs.readFileSync('package.json');

// stop monitoring
monitor.stop();

// read file system call stats
const heimdall = require('heimdalljs');
const stats = heimdall.statsFor('fs');
```

### Getting invocation stacks

In order to get more information about where fs calls are coming from, simply adding an environment variable called `HEIMDALL_FS_MONITOR_CALL_TRACING` and setting that to 1 will add an invocation object to the fs.stats[{fsFunctionName}] object. This could be a potential place where memory backpressure will occur, as this will continue to grow during a build. Since we are not storing every invocation as an entry in an array, and instead just increasing the count for a particular stack trace, this should only be used when needed.

```js
process.env.HEIMDALL_FS_MONITOR_CALL_TRACING = 1;

const FSMonitor = require('heimdalljs-fs-monitor');

// create a new file system monitor
const monitor = new FSMonitor();

// start monitoring
monitor.start();

// ... do some file system work ...
var fs = require('fs');
fs.readFileSync('package.json');

// stop monitoring
monitor.stop();
```

Accessing `heimdall.fs.stats.readFileSync`, for example will yeild a _Metric_ object that looks like the following:

```js
{
  count: 1,
  time: 821855,
  invocations: {
    '    at Object.readFileSync (~/heimdall-fs-monitor/index.js:112:35)\n    at Context.<anonymous> (~/heimdall-fs-monitor/tests.js:89:8)\n    at callFn (~/heimdall-fs-monitor/node_modules/mocha/lib/runnable.js:370:21)\n    at Test.Runnable.run (~/heimdall-fs-monitor/node_modules/mocha/lib/runnable.js:357:7)\n    at Runner.runTest (~/heimdall-fs-monitor/node_modules/mocha/lib/runner.js:541:10)\n    at ~/heimdall-fs-monitor/node_modules/mocha/lib/runner.js:667:12\n    at next (~/heimdall-fs-monitor/node_modules/mocha/lib/runner.js:450:14)\n    at ~/heimdall-fs-monitor/node_modules/mocha/lib/runner.js:460:7\n    at next (~/heimdall-fs-monitor/node_modules/mocha/lib/runner.js:362:14)\n    at Immediate._onImmediate (~/heimdall-fs-monitor/node_modules/mocha/lib/runner.js:428:5)': {
      lineNumber: 89,
      fileName: '~/heimdall-fs-monitor/tests.js',
      count: 1
    }
  }
}
```


## License
`heimdall-fs-monitor` is licensed under the [ISC License](https://opensource.org/licenses/isc-license.txt).

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