# inspector-api

> A simple node module to access V8 inspector + some tools to export and read the data.

Latest version **1.5.0** (published 2026-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install inspector-api
pnpm add inspector-api
yarn add inspector-api
bun add inspector-api
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2026-09-25 |
| First published | 2019-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.0.0 |
| Dependencies | 1 |
| Unpacked size | 17.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wallet77 |
| Maintainers | wallet77 |
| Keywords | v8, inspector, profiler, profiling, cpu, memory, coverage, heap, HeapSnapshot, performance, sampling |

## Links

- npm: https://www.npmjs.com/package/inspector-api
- Repository: https://github.com/wallet77/v8-inspector-api
- Homepage: https://github.com/wallet77/v8-inspector-api#readme
- Issues: https://github.com/wallet77/v8-inspector-api/issues
- npm.io page: https://npm.io/package/inspector-api

## Dependencies (1)

- [@aws-sdk/client-s3](https://npm.io/package/@aws-sdk/client-s3.md) ^3.1140.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.5.0 (latest) — 2026-09-25
- 1.4.11 — 2025-01-10
- 1.4.10 — 2024-09-03
- 1.4.9 — 2024-02-28
- 1.4.8 — 2023-11-27
- 1.4.7 — 2023-06-26
- 1.4.6 — 2022-12-22
- 1.4.5 — 2022-09-01
- 1.4.4 — 2022-06-24
- 1.4.3 — 2021-11-16
- 1.4.2 — 2021-09-09
- 1.4.1 — 2021-06-10
- 1.4.0 — 2021-06-01
- 1.3.0 — 2021-02-26
- 1.2.1 — 2020-12-10
- … 7 more at https://npm.io/package/inspector-api/versions

## README

[![GitHub release](https://img.shields.io/npm/v/inspector-api.svg)](https://github.com/wallet77/v8-inspector-api/releases/)
[![GitHub license](https://img.shields.io/github/license/wallet77/v8-inspector-api.svg)](https://github.com/wallet77/v8-inspector-api/blob/master/LICENSE)

[![CI pipeline](https://github.com/wallet77/v8-inspector-api/workflows/Node.js%20CI/badge.svg)](https://github.com/wallet77/v8-inspector-api/actions?query=workflow%3A%22Node.js+CI%22)
[![Code coverage](https://codecov.io/gh/wallet77/v8-inspector-api/branch/master/graph/badge.svg)](https://codecov.io/gh/wallet77/v8-inspector-api)
[![Opened issues](https://img.shields.io/github/issues-raw/wallet77/v8-inspector-api)](https://github.com/wallet77/v8-inspector-api/issues)
[![Opened PR](https://img.shields.io/github/issues-pr-raw/wallet77/v8-inspector-api)](https://github.com/wallet77/v8-inspector-api/pulls)
[![DeepScan grade](https://deepscan.io/api/teams/12061/projects/15020/branches/292505/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=12061&pid=15020&bid=292505)
[![Node version](https://img.shields.io/node/v-lts/inspector-api.svg)](https://github.com/wallet77/v8-inspector-api)

# Purpose

Simple wrapper around "inspector" module.
Basically it adds :
- promises & async/await syntax
- S3 exporter

# Compatibility

| Version       | Supported     | Tested         |
|:-------------:|:-------------:|:--------------:|
| 24.x          | yes           | yes            |
| 22.x          | yes           | yes            |
| 20.x          | yes           | yes            |
| 18.x          | yes           | yes            |
| 16.x          | yes           | yes            |

**In order to have all features we recommend to use at least Node.js version 10 or higher.**

# Installation

```console
$ npm install inspector-api --save
```

# Usage

## CPU profiling
```javascript
const Inspector = require('inspector-api')
const inspector = new Inspector()

await inspector.profiler.enable()
await inspector.profiler.start()
// Invoke business logic under measurement here...

// some time later...
await inspector.profiler.stop()

```

## Memory sampling
```javascript
const Inspector = require('inspector-api')
const inspector = new Inspector()

await inspector.heap.enable()
await inspector.heap.startSampling()
// Invoke business logic under measurement here...

// some time later...
await inspector.heap.stopSampling()

```

## Memory snapshot
```javascript
const Inspector = require('inspector-api')
const inspector = new Inspector()

await inspector.heap.takeSnapshot()

```

## Code coverage
```javascript
const Inspector = require('inspector-api')
const inspector = new Inspector()

await inspector.profiler.enable()
await inspector.profiler.startPreciseCoverage({ callCount: true, detailed: true })

const data = await inspector.profiler.takePreciseCoverage()
await inspector.profiler.stopPreciseCoverage()

```

## Use S3 exporter
```javascript
const Inspector = require('inspector-api')
const inspector = new Inspector({
    storage: {
        type: 's3',
        bucket: 'testBucket',
        dir: 'inspector'
    }
})

await inspector.profiler.enable()
await inspector.profiler.start()
// Invoke business logic under measurement here...

// some time later...
await inspector.profiler.stop()

```

**Warning: it seems that the new AWS SDK leads to unexpected error if you use the takeSnapshot method (you should use memory sampling)**

### Constructor's config

```javascript
new inspector([config])
```

#### config.storage

| Option        | description                                | Default value  |
|:-------------:|:------------------------------------------:|:--------------:|
| `type`        | Storage type (raw, s3 or fs)               | raw            |
| `bucket`      | S3 bucket's name                           | none           |
| `dir`         | Directory where to store the file          | none           |

If you use fs, the generated data will be store on the disk in your default tmp directory.
You can display it in Node.js with the command `require('os').tmpdir()`

# Test

```console
$ npm test
```

Coverage report can be found in coverage/.

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