--snapshot-blob=path


稳定性: 1 - 实验

--build-snapshot 一起使用时,--snapshot-blob 指定写入生成的快照 blob 的路径。 如果不指定,生成的 blob 会写入当前工作目录下的 snapshot.blob

在没有 --build-snapshot 的情况下使用时,--snapshot-blob 指定用于恢复应用程序状态的 blob 的路径。

加载快照时,Node.js 检查:

  1. 运行的 Node.js 二进制文件的版本、架构和平台与生成快照的二进制文件完全相同。
  2. V8 标志和 CPU 功能与生成快照的二进制文件兼容。

如果它们不匹配,Node.js 拒绝加载快照并以状态码 1 退出。

Stability: 1 - Experimental

When used with --build-snapshot, --snapshot-blob specifies the path where the generated snapshot blob is written to. If not specified, the generated blob is written to snapshot.blob in the current working directory.

When used without --build-snapshot, --snapshot-blob specifies the path to the blob that is used to restore the application state.

When loading a snapshot, Node.js checks that:

  1. The version, architecture and platform of the running Node.js binary are exactly the same as that of the binary that generates the snapshot.
  2. The V8 flags and CPU features are compatible with that of the binary that generates the snapshot.

If they don't match, Node.js refuses to load the snapshot and exits with status code 1.