MCPcopy Create free account
hub / github.com/facebook/memlab / loadFromFiles

Method loadFromFiles

packages/e2e/src/ScriptManager.ts:46–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 }
45
46 public loadFromFiles(): boolean {
47 this.init();
48 const webSourceMetaFile = fileManager.getWebSourceMetaFile();
49 const webSourceDir = fileManager.getWebSourceDir();
50 if (!fs.existsSync(webSourceMetaFile) || !fs.existsSync(webSourceDir)) {
51 return false;
52 }
53 try {
54 const metaContent = fs.readFileSync(webSourceMetaFile, {
55 encoding: 'utf8',
56 });
57 this.scriptInfos = JSON.parse(metaContent);
58 for (const scriptInfo of this.scriptInfos) {
59 this.urlToScriptMap.set(scriptInfo.url, scriptInfo);
60 }
61 } catch {
62 return false;
63 }
64 return true;
65 }
66
67 public loadCodeForUrl(url: string): Nullable<string> {
68 if (!this.urlToScriptMap.has(url)) {

Callers 2

displaySourceCodeFunction · 0.95
constructorMethod · 0.80

Calls 5

initMethod · 0.95
getWebSourceMetaFileMethod · 0.80
getWebSourceDirMethod · 0.80
parseMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected