From b11725eb9e36cbf7e8a9b57aebbbb5e32ea14dff Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 28 Oct 2020 06:58:45 -0700 Subject: [PATCH] doc: revise v8.getHeapSnapshot() * move entry above v8.getHeapSpaceStatistics() (where it belongs alphabetically and is not out of place logically) * split lengthy sentence into two sentences PR-URL: https://github.com/nodejs/node/pull/35849 Reviewed-By: Michael Dawson --- doc/api/v8.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/doc/api/v8.md b/doc/api/v8.md index 75cf9bae0fbe02..eb76506f46be28 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -32,6 +32,26 @@ v8.setFlagsFromString('--allow_natives_syntax'); console.log(v8.cachedDataVersionTag()); // 183726201 ``` +## `v8.getHeapSnapshot()` + + +* Returns: {stream.Readable} A Readable Stream containing the V8 heap snapshot + +Generates a snapshot of the current V8 heap and returns a Readable +Stream that may be used to read the JSON serialized representation. +This JSON stream format is intended to be used with tools such as +Chrome DevTools. The JSON schema is undocumented and specific to the +V8 engine. Therefore, the schema may change from one version of V8 to the next. + +```js +// Print heap snapshot to the console +const v8 = require('v8'); +const stream = v8.getHeapSnapshot(); +stream.pipe(process.stdout); +``` + ## `v8.getHeapSpaceStatistics()` - -* Returns: {stream.Readable} A Readable Stream containing the V8 heap snapshot - -Generates a snapshot of the current V8 heap and returns a Readable -Stream that may be used to read the JSON serialized representation. -This JSON stream format is intended to be used with tools such as -Chrome DevTools. The JSON schema is undocumented and specific to the -V8 engine, and may change from one version of V8 to the next. - -```js -// Print heap snapshot to the console -const v8 = require('v8'); -const stream = v8.getHeapSnapshot(); -stream.pipe(process.stdout); -``` - ## `v8.getHeapStatistics()`