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