本文整理汇总了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' });
});