本文整理汇总了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);
});
}
示例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)
}
示例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;
}, []));
示例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);
});
}
示例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;
示例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);
});
}
示例7:
}).then(() => {
return FS.read(path.join(gitTest.extraDir, 'tmp_test.bin'), {flags:'rb'});
}, (err) => {