本文整理汇总了TypeScript中fs.readFileSync.bind方法的典型用法代码示例。如果您正苦于以下问题:TypeScript readFileSync.bind方法的具体用法?TypeScript readFileSync.bind怎么用?TypeScript readFileSync.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fs.readFileSync
的用法示例。
在下文中一共展示了readFileSync.bind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
export default function(
globalObject: NodeJS.Global,
globals: Config.ConfigGlobals,
): NodeJS.Global & Config.ConfigGlobals {
globalObject.process = createProcessObject();
const symbol = (globalObject.Symbol as unknown) as SymbolConstructor;
// Keep a reference to some globals that Jest needs
Object.defineProperties(globalObject, {
[symbol.for('jest-native-promise')]: {
enumerable: false,
value: Promise,
writable: false,
},
[symbol.for('jest-native-now')]: {
enumerable: false,
value: globalObject.Date.now.bind(globalObject.Date),
writable: false,
},
[symbol.for('jest-native-read-file')]: {
enumerable: false,
value: fs.readFileSync.bind(fs),
writable: false,
},
[symbol.for('jest-native-write-file')]: {
enumerable: false,
value: fs.writeFileSync.bind(fs),
writable: false,
},
[symbol.for('jest-native-exists-file')]: {
enumerable: false,
value: fs.existsSync.bind(fs),
writable: false,
},
'jest-symbol-do-not-touch': {
enumerable: false,
value: symbol,
writable: false,
},
});
// Forward some APIs.
DTRACE.forEach(dtrace => {
// @ts-ignore: no index
globalObject[dtrace] = function(...args: Array<any>) {
// @ts-ignore: no index
return global[dtrace].apply(this, args);
};
});
// Forward some others (this breaks the sandbox but for now it's OK).
globalObject.Buffer = global.Buffer;
globalObject.setImmediate = global.setImmediate;
globalObject.clearImmediate = global.clearImmediate;
return Object.assign(globalObject, deepCyclicCopy(globals));
}