sourceTextModule.createCachedData()
添加於:v13.7.0、v12.17.0
- 返回: <Buffer>
創建可與 SourceTextModule
構造函數的 cachedData
選項一起使用的代碼緩存。返回 Buffer
。在評估模塊之前,可以多次調用此方法。
// Create an initial module
const module = new vm.SourceTextModule('const a = 1;');
// Create cached data from this module
const cachedData = module.createCachedData();
// Create a new module using the cached data. The code must be the same.
const module2 = new vm.SourceTextModule('const a = 1;', { cachedData });
相關用法
- Node.js vm.SyntheticModule.setExport(name, value)用法及代碼示例
- Node.js vm.SyntheticModule用法及代碼示例
- Node.js vm.Script.createCachedData()用法及代碼示例
- Node.js vm.Script.runInNewContext([contextObject[, options]])用法及代碼示例
- Node.js vm.Script.runInThisContext([options])用法及代碼示例
- Node.js vm.Script.runInContext(contextifiedObject[, options])用法及代碼示例
- Node.js vm.createContext([contextObject[, options]])用法及代碼示例
- Node.js vm.Module用法及代碼示例
- Node.js vm.runInThisContext(code[, options])用法及代碼示例
- Node.js vm.isContext()用法及代碼示例
- Node.js vm.measureMemory([options])用法及代碼示例
- Node.js vm.runInNewContext()用法及代碼示例
- Node.js vm.runInNewContext(code[, contextObject[, options]])用法及代碼示例
- Node.js vm.createContext()用法及代碼示例
- Node.js vm.runInThisContext()用法及代碼示例
- Node.js vm.runInContext()用法及代碼示例
- Node.js vm.runInContext(code, contextifiedObject[, options])用法及代碼示例
- Node.js vm.Module.link(linker)用法及代碼示例
- Node.js v8.getHeapSpaceStatistics()用法及代碼示例
- Node.js v8.deserializer.readRawBytes()用法及代碼示例
- Node.js v8.deserializer.readUint32()用法及代碼示例
- Node.js v8.serializer.writeRawBytes()用法及代碼示例
- Node.js v8.writeHeapSnapshot([filename])用法及代碼示例
- Node.js v8.Deserializer.readUint32()用法及代碼示例
- Node.js v8.getHeapCodeStatistics()用法及代碼示例
注:本文由純淨天空篩選整理自nodejs.org大神的英文原創作品 vm.SourceTextModule.createCachedData()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。