MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / readText

Method readText

packages/core/file-system/index.ts:598–623  ·  view source on GitHub ↗
(encoding?: string)

Source from the content-addressed store, hash-verified

596 }
597
598 public readText(encoding?: string): Promise<string> {
599 return new Promise((resolve, reject) => {
600 try {
601 this._checkAccess();
602 } catch (ex) {
603 reject(ex);
604
605 return;
606 }
607
608 this._locked = true;
609
610 getFileAccess()
611 .readTextAsync(this.path, encoding)
612 .then(
613 (result) => {
614 resolve(result);
615 this._locked = false;
616 },
617 (error) => {
618 reject(error);
619 this._locked = false;
620 },
621 );
622 });
623 }
624
625 public readTextSync(onError?: (error: any) => any, encoding?: string): string {
626 this._checkAccess();

Callers

nothing calls this directly

Calls 4

_checkAccessMethod · 0.95
getFileAccessFunction · 0.85
readTextAsyncMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected