创建可与 Script 构造函数的 cachedData 选项一起使用的代码缓存。 返回 Buffer。 此方法可以随时调用任意次数。

    Creates a code cache that can be used with the Script constructor's cachedData option. Returns a Buffer. This method may be called at any time and any number of times.

    const script = new vm.Script(`
    function add(a, b) {
      return a + b;
    const x = add(1, 2);
    const cacheWithoutX = script.createCachedData();
    const cacheWithX = script.createCachedData();