阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js script.createCachedData

      Node.js script.createCachedData()

      新增于: v10.6.0

      • Returns: < 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();
      
      script.runInThisContext();
      
      const cacheWithX = script.createCachedData();
      

      更多内容请参考:Node.js vm,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录