本文整理汇总了TypeScript中mz/fs.readFileSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript readFileSync函数的具体用法?TypeScript readFileSync怎么用?TypeScript readFileSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readFileSync函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getVersion
function getVersion(): string {
const packageFilePath = path.resolve(__dirname, '../package.json');
const packageFile = fs.readFileSync(packageFilePath).toString();
const packageJson = JSON.parse(packageFile);
const version = packageJson['version'];
return version;
}
示例2: readThingSchemaFromFiles
public static readThingSchemaFromFiles(ramlFilePath: string): ThingSchema {
let raml = fs.readFileSync(ramlFilePath, "utf8");
// TODO: Scan for `!include *.json` lines in the RAML, then load JSON files (sync).
// TODO: Scan for `$ref` objects in each JSON, then recursively load references (sync).
// (Both sync and async read implementations may be desirable in difference scenarios.)
throw new Error("not implemented");
}