worker.getHeapSnapshot([options])


  • options <Object>

    • exposeInternals <boolean> 如果为真,则在堆快照中公开内部结构。默认值:false

      ¥exposeInternals <boolean> If true, expose internals in the heap snapshot. Default: false.

    • exposeNumericValues <boolean> 如果为真,则在人工字段中公开数值。默认值:false

      ¥exposeNumericValues <boolean> If true, expose numeric values in artificial fields. Default: false.

  • 返回:<Promise> 对包含 V8 堆快照的可读流的 promise

    ¥Returns: <Promise> A promise for a Readable Stream containing a V8 heap snapshot

返回工作线程当前状态的 V8 快照的可读流。有关详细信息,请参阅 v8.getHeapSnapshot()

¥Returns a readable stream for a V8 snapshot of the current state of the Worker. See v8.getHeapSnapshot() for more details.

如果工作线程不再运行(这可能发生在触发 'exit' 事件 之前),则返回的 Promise 会立即被拒绝,并出现 ERR_WORKER_NOT_RUNNING 错误。

¥If the Worker thread is no longer running, which may occur before the 'exit' event is emitted, the returned Promise is rejected immediately with an ERR_WORKER_NOT_RUNNING error.