本文整理汇总了TypeScript中fs-promise.writeFile函数的典型用法代码示例。如果您正苦于以下问题:TypeScript writeFile函数的具体用法?TypeScript writeFile怎么用?TypeScript writeFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeFile函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: writeFile
public writeFile(path: string, resource: Resource, resourceType: ResourceType): Promise<void> {
let data: any = resource || { };
let encoding = data["_encoding"] || resolveEncoding(resourceType);
let body = data["body"] || "";
return fs.writeFile(path, body, encoding);
}
示例2:
this.forEachWithFiltersTopLevel([skipMeta], (item) => {
const itemPath = path.join(outputDir, item.filename);
if (item.isDirectory) {
item.children.writeToPath(itemPath);
} else {
fsp.writeFile(itemPath, item.content);
}
});
示例3: async
const resetTestModule = async () => {
await fs.remove(testModulePath);
await fs.mkdirs(testModulePath);
await fs.writeFile(path.resolve(testModulePath, 'package.json'), await fs.readFile(path.resolve(__dirname, '../test/fixture/native-app1/package.json'), 'utf8'));
await spawnPromise('npm', ['install'], {
cwd: testModulePath,
stdio: 'inherit',
});
};
示例4:
.then(code => {
return fsp.writeFile(outfile, code);
})
示例5: writeFile
public writeFile(path: string, resource: Resource, resourceType: ResourceType): Promise<void> {
let body = (resource && resource.body) || new Buffer(0);
return fs.writeFile(path, body);
}