# @hstech/memviz

> Tool for the visualization of the Node.js memory usage in runtime.

Latest version **1.7.0** (published 2021-06-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hstech/memviz
pnpm add @hstech/memviz
yarn add @hstech/memviz
bun add @hstech/memviz
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2021-06-22 |
| First published | 2021-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 14 |
| Unpacked size | 27.1 KB |
| Known vulnerabilities | 0 (+10 in 3 direct dependencies) |
| Install scripts | no |
| Author | Mouadh HSOUMI |
| Maintainers | roonie007 |
| Keywords | memory, memory visualize, visualize memory, visualize, memviz, memvis, mem-viz, mem-vis |

## Links

- npm: https://www.npmjs.com/package/@hstech/memviz
- npm.io page: https://npm.io/package/@hstech/memviz

## Dependencies (14)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [os](https://npm.io/package/os.md) ^0.1.1
- [ejs](https://npm.io/package/ejs.md) ^3.1.6
- [koa](https://npm.io/package/koa.md) ^2.13.1
- [path](https://npm.io/package/path.md) ^0.12.7
- [moment](https://npm.io/package/moment.md) ^2.29.1
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.931.0
- [fastify](https://npm.io/package/fastify.md) ^3.17.0
- [heapdump](https://npm.io/package/heapdump.md) ^0.3.15
- [url-join](https://npm.io/package/url-join.md) ^4.0.1
- [@koa/router](https://npm.io/package/@koa/router.md) ^10.0.0
- [gc-profiler](https://npm.io/package/gc-profiler.md) ^1.4.1
- [fastify-cors](https://npm.io/package/fastify-cors.md) ^6.0.1
- [point-of-view](https://npm.io/package/point-of-view.md) ^4.14.0

## Recent versions

- 1.7.0 (latest) — 2021-06-22
- 1.6.2 — 2021-06-21
- 1.6.1 — 2021-06-21
- 1.6.0 — 2021-06-21
- 1.5.2 — 2021-06-15
- 1.5.1 — 2021-06-15
- 1.5.0 — 2021-06-15
- 1.4.1 — 2021-06-14
- 1.4.0 — 2021-06-14
- 1.3.1 — 2021-06-14
- 1.3.0 — 2021-06-14
- 1.2.0 — 2021-06-14
- 1.1.0 — 2021-06-14
- 1.0.1 — 2021-06-14
- 1.0.0 — 2021-06-14

## README

# @hstech/memviz

Tool for the visualization of the Node.js memory usage in an application.

[![NPM Version][npm-image]][npm-url]

![memviz demo](https://i.ibb.co/frGVPjD/Capturer.jpg "memviz demo")

## Install

```bash
npm i -S @hstech/memviz
```

## Usage

Just add this code to your index.js

```javascript
const memViz = require("@hstech/memviz");

memViz({ port: 10101 });
```

## Options

All options are optional

> **PS: for S3 snapshot upload please provide these environment variables**
>
> ```
> AWS_CREDENTIALS_ACCESSKEY_ID // AWS access key associated with an IAM user or role
> AWS_CREDENTIALS_SECRET_ACCESS_KEY // The secret key associated with the access key
> ```

```javascript
{
  port: 10100,  // Port (default)
  interval: 300, // Refresh interval of data in milliseconds (default)
  duration: 120000, // Duration of the chart in milliseconds, how much time of data it will show. (default)
  application: 'Application' // Application name (default)

  s3: { // If s3.bucket is null, the heapsnapshot will be written to disc
    bucket: 'YOUR_BUCKET_NAME', // default is null
    folder: '/sub-folder' // default is '/'
  }
}

```

## Interaction

You can zoom in/out the chart using the mouse wheel or via a pinch gesture, you can also move the chart left or right.

## MultiView

Visit any of your Visualizer host with the path `/memviz/multiview` example `http://localhost:10100/memviz/multiview`.

Let's say you want to display 3 charts on the same view, for these hosts

- `http://localhost:10100/memviz/`
- `http://localhost:10101/memviz/`
- `http://localhost:10102/memviz/`

and you want to display 2 in each row, then your url should look like this:

**`http://localhost:10100/memviz/multiview?perRow=2&hosts=http://localhost:10100/,http://localhost:10101/,http://localhost:10102/`**

## Integration

### Koa

To integrate memviz into Koa, all you have to do is to pass the Instance and the port to memviz

```javascript
// Koa instance is in app variable

memViz({
  koa: app, // Koa instance
  port: 3000, // Koa instance port
  interval: 300,
  duration: 120000,
  application: "Application 1",
});
```

Then visit this path `/memviz/` you should see the memory graph

## License

[MIT](http://vjpr.mit-license.org)

[npm-image]: https://img.shields.io/npm/v/@hstech/memviz.svg
[npm-url]: https://npmjs.org/package/@hstech/memviz

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