MCPcopy Create free account
hub / github.com/firebase/firebase-tools / parse

Method parse

src/profileReport.ts:512–553  ·  view source on GitHub ↗
(onLine: any, onClose: any)

Source from the content-addressed store, hash-verified

510 }
511
512 async parse(onLine: any, onClose: any): Promise<void> {
513 const isFile = this.options.isFile;
514 const tmpFile = this.tempFile;
515 const outStream = this.output;
516 const isInput = this.options.isInput;
517 return new Promise((resolve, reject) => {
518 const rl = readline.createInterface({
519 input: fs.createReadStream(tmpFile),
520 });
521 let errored = false;
522 rl.on("line", (line) => {
523 const data = extractJSON(line, isInput);
524 if (!data) {
525 return;
526 }
527 onLine(data);
528 });
529 rl.on("close", () => {
530 if (errored) {
531 reject(new FirebaseError("There was an error creating the report."));
532 } else {
533 const result = onClose();
534 if (isFile) {
535 // Only resolve once the data is flushed.
536 outStream.on("finish", () => {
537 resolve(result);
538 });
539 outStream.end();
540 } else {
541 resolve(result);
542 }
543 }
544 });
545 rl.on("error", () => {
546 reject();
547 });
548 outStream.on("error", () => {
549 errored = true;
550 rl.close();
551 });
552 });
553 }
554
555 write(data: any) {
556 if (this.options.isFile) {

Callers 15

generateRawMethod · 0.95
generateTextMethod · 0.95
generateJsonMethod · 0.95
uninstallLegacyFirepitFunction · 0.80
GetFirebaseToolsBinsFunction · 0.80
CheckIsLoggedInFunction · 0.80
requestCallBackMethod · 0.80
extractJSONFunction · 0.80
index.tsFile · 0.80

Calls 5

extractJSONFunction · 0.85
resolveFunction · 0.85
onMethod · 0.80
closeMethod · 0.80
rejectFunction · 0.70

Tested by 4

endpointFunction · 0.64
uploadTextFunction · 0.64
startRuntimeFunction · 0.64
getTestFilesFunction · 0.64