本文整理匯總了TypeScript中fs-plus.writeFileSync函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript writeFileSync函數的具體用法?TypeScript writeFileSync怎麽用?TypeScript writeFileSync使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了writeFileSync函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: beforeEach
beforeEach(() => {
workingDirectory = copySubmoduleRepository()
repo = Repository.open(workingDirectory)
modifiedPath = path.join(workingDirectory, 'jstips', 'README.md')
newPath = path.join(workingDirectory, 'You-Dont-Need-jQuery', 'untracked.txt')
cleanPath = path.join(workingDirectory, 'jstips', 'CONTRIBUTING.md')
fs.writeFileSync(newPath, '')
fs.writeFileSync(modifiedPath, 'making this path modified')
newPath = fs.absolute(newPath) // specs could be running under symbol path.
})
示例2: it
it('trigger a status-changed event when the new status differs from the last cached one', async () => {
const statusHandler = jasmine.createSpy('statusHandler')
repo.onDidChangeStatus(statusHandler)
fs.writeFileSync(filePath, '')
await repo.getPathStatus(filePath)
expect(statusHandler.calls.count()).toBe(1)
const status = Git.Status.STATUS.WT_MODIFIED
expect(statusHandler).toHaveBeenCalledWith({path: filePath, pathStatus: status})
fs.writeFileSync(filePath, 'abc')
await repo.getPathStatus(filePath)
expect(statusHandler.calls.count()).toBe(1)
})
示例3: join
return prettier.parse().then(types => {
const errorsPath = join(dist, `go-const-errors.log`);
removeSync(errorsPath);
if (prettier.errors.length) {
writeFileSync(errorsPath, prettier.errors.join('\n'), { encoding: 'utf8' });
}
const promises = [
formateWrite(join(dist, 'pipe/index-base.pipe.ts'), indexBasePipeTpl),
formateWrite(join(dist, `pipe.ts`), pipeIndex({ types })),
formateWrite(join(dist, `enum.ts`), enumIndex({ types })),
];
types.forEach(type => {
promises.push(
formateWrite(join(dist, `pipe/${type.pipe}.pipe.ts`), pipeItem(type)),
formateWrite(join(dist, `enum/${type.pipe}.enum.ts`), enumItem(type)),
// names
writeFile(join(dist, `names/${type.pipe}.json`), type.names),
// xlangJson
...type.langs.map(lang => writeFile(join(dist, `xlang/${type.pipe}/${lang.lang}.json`), lang.langJson)),
);
});
return Promise.all(promises);
});
示例4: writeFileSync
result => {
if (result.error) {
console.error('formateWrite failed', result.message);
} else {
writeFileSync(fileName, result.dest, { encoding: 'utf8' });
}
},
示例5: connect
return connect(this.config.driver).then(async c => {
const { column, value, dist } = this.config;
const query = c.getRepository(Phone)
.createQueryBuilder('p')
.select('phone')
.where(`p."${column}" = :v`, { v: value });
const ps = await query.getRawMany();
c.close();
const list = ps.map((p: Phone) => p.phone).join('\n');
writeFileSync(dist, list, { encoding: 'utf8' });
});