v8.startupSnapshot.addSerializeCallback(callback[, data])


  • callback <Function> 在序列化之前调用的回调函数。
  • data <any> 可选数据,在调用 callback 时会传递给它。

添加一个回调函数,当 Node.js 实例即将被序列化为快照并退出时会调用它。可以用它来释放不应或无法序列化的资源,或将用户数据转换为更适合序列化的形式。

🌐 Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit. This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization.