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


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

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

  • callback <Function> Callback to be invoked before serialization.
  • data <any> Optional data that will be passed to the callback when it gets called.

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.