本文整理汇总了TypeScript中q-io/fs.read函数的典型用法代码示例。如果您正苦于以下问题:TypeScript read函数的具体用法?TypeScript read怎么用?TypeScript read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: readConfigFile
readConfigFile() {
return fs.read(configFile).then((data: any) => {return JSON.parse(data); },
(err: any) => {
this.logger.log('Error on reading Config File!');
this.logger.log(err);
});
}
开发者ID:DanielSchuech,项目名称:webend,代码行数:7,代码来源:configuration.ts
示例2: printTailAndWatchFile
async function printTailAndWatchFile(file:any, tailSize:number) {
if (await qfs.exists(file)) {
const content = await qfs.read(file)
const lines = content.split('\n')
const from = Math.max(0, lines.length - tailSize)
const lastLines = lines.slice(from).join('\n')
console.log(lastLines)
}
watchFile(file)
}
开发者ID:duniter,项目名称:duniter,代码行数:10,代码来源:daemon.ts
示例3:
return Q.all(names.reduce((memo:any[], name:string) => {
var pack = path.join(src, project, name);
memo.push(Q.all([
xm.file.readJSONPromise(path.join(pack, 'fields.json')),
FS.read(path.join(pack, 'header.ts'))
]).spread((fields, header) => {
var data = new helper.HeaderAssert(project, name);
data.fields = fields;
data.header = header;
res.push(data);
}));
return memo;
}, []));
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:13,代码来源:HeaderHelper.ts
示例4: lsc
function lsc(inputLambdaScriptFile: string, outputJsFile: string) {
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);
});
}
开发者ID:NickHeiner,项目名称:lambdascript,代码行数:15,代码来源:index.ts
示例5:
var headers:QioHTTP.Headers;
var reader:Qio.Reader;
var writer:Qio.Writer;
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;
开发者ID:3x14159265,项目名称:DefinitelyTyped,代码行数:30,代码来源:Q-io-tests.ts
示例6: lscHighlight
function lscHighlight(inputLambdaScriptFile: string): Q.IPromise<string> {
return qFs.read(inputLambdaScriptFile).then(function(lambdaScriptCode: string) {
const lscAst = getLscAst(lambdaScriptCode);
return getHighlightedCode(lscAst, lambdaScriptCode);
});
}
开发者ID:NickHeiner,项目名称:lambdascript,代码行数:6,代码来源:index.ts
示例7:
}).then(() => {
return FS.read(path.join(gitTest.extraDir, 'tmp_test.bin'), {flags:'rb'});
}, (err) => {
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:3,代码来源:Github.ts
注:本文中的q-io/fs.read函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论