MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / sendTcpReloadPath

Function sendTcpReloadPath

scripts/experimental/swiftui-preview.mjs:527–540  ·  view source on GitHub ↗
(context, dylibPath)

Source from the content-addressed store, hash-verified

525}
526
527async function sendTcpReloadPath(context, dylibPath) {
528 const containerPath = appContainerPath(context);
529 const documentsDir = path.join(containerPath, "Documents");
530 fs.mkdirSync(documentsDir, { recursive: true });
531 const installedDylibPath = path.join(documentsDir, path.basename(dylibPath));
532 fs.copyFileSync(dylibPath, installedDylibPath);
533 for (let offset = 0; offset < RELOAD_PORT_LIMIT; offset += 1) {
534 const port = RELOAD_PORT_START + offset;
535 if (await sendTcpReloadToPort(port, installedDylibPath)) {
536 return true;
537 }
538 }
539 return false;
540}
541
542async function sendTcpReloadBytes(dylibPath) {
543 const base64 = fs.readFileSync(dylibPath).toString("base64");

Callers 1

reloadPreviewFunction · 0.85

Calls 2

appContainerPathFunction · 0.85
sendTcpReloadToPortFunction · 0.85

Tested by

no test coverage detected