本文整理汇总了TypeScript中q-io/fs.write函数的典型用法代码示例。如果您正苦于以下问题:TypeScript write函数的具体用法?TypeScript write怎么用?TypeScript write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: writeConfigFile
writeConfigFile(config: any) {
return fs.write(configFile, JSON.stringify(config, null , 2)).then(
(data: any) => {return data; },
(err: any) => {
this.logger.log('Error on writing Config File!');
this.logger.log(err);
});
}
示例2: getLscAst
return qFs.read(inputLambdaScriptFile).then(function(lambdaScriptCode: string) {
const lscAst = getLscAst(lambdaScriptCode),
jsAst = astToJsAst(lscAst);
logger.debug({jsAst: jsAst}, 'Converted LambdaScript AST to JS AST');
const js = escodegen.generate(jsAst);
logger.debug({js: js}, 'Generated raw js');
const jsWithPrelude = withPrelude(js);
logger.debug({jsWithPrelude: jsWithPrelude}, 'Added prelude to raw js');
return qFs.write(outputJsFile, jsWithPrelude);
});
示例3:
}).then(() => {
return FS.write(targetPath, file.blob.content);
}).then(() => {
示例4:
var stream:Qio.Stream;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fs.open(path, options).then((x) => {
});
//fs.open(path, options):Q.Promise<Qio.Reader>;
//fs.open(path, options):Q.Promise<Qio.Writer>;
//fs.open(path, options):Q.Promise<NodeBuffer>;
//TODO how to define the multiple return types? use any for now?
anyQ = fs.read(path, options);
//strQ = fs.read(path, options);
//fs.read(path, options):Q.Promise<NodeBuffer>;
voidQ = fs.write(path, buffer, options);
voidQ = fs.write(path, str, options);
voidQ = fs.append(path, buffer, options);
voidQ = fs.append(path, str, options);
voidQ = fs.copy(source, target);
voidQ = fs.copyTree(source, target);
strArrQ = fs.list(path);
strArrQ = fs.listTree(path, (path, x) => {
return true;
});
strArrQ = fs.listDirectoryTree(path);
voidQ = fs.makeDirectory(path, str);
示例5:
return xm.file.mkdirCheckQ(gitTest.extraDir, true).then(() => {
return FS.write(path.join(gitTest.extraDir, 'tmp_test.bin'), rawData, {flags:'wb'});
}).then(() => {