Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huruji/inspector-api
v8 inspector api wrapper
https://github.com/huruji/inspector-api
Last synced: about 2 months ago
JSON representation
v8 inspector api wrapper
- Host: GitHub
- URL: https://github.com/huruji/inspector-api
- Owner: huruji
- Created: 2021-08-22T15:55:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-25T14:58:13.000Z (over 3 years ago)
- Last Synced: 2024-11-11T11:45:01.535Z (2 months ago)
- Language: TypeScript
- Size: 99.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-github-star - inspector-api
README
# inspector-api
v8 inspector api wrapper# 使用
```bash
npm i inspector-api-wrapper
``````js
import Inspector from 'inspector-api-wrapper'
const inspectorIns = new Inspector()
```## 获取 cpu Profile
```js
inspectorIns.profiler.getInfo(5000).then(data => {
fs.writeFileSync(`./cpuprofile-${Date.now()}.cpuprofile`, JSON.stringify(data))
})
```## 获取堆内存快照
```js
inspectorIns.heap.taskSnapshot().then(data => {
fs.writeFileSync(`./heapsnapshot-${Date.now()}.heapsnapshot`, data)
})
```## 获取堆内存 sampling
```js
inspectorIns.heap.getProfile().then(data => {
fs.writeFileSync(`./heapprofile-${Date.now()}.heapprofile`, JSON.stringify(data))
})
```