本文整理匯總了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");
}