本文整理匯總了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(() => {