MCPcopy Index your code
hub / github.com/tensorflow/tfjs / main

Function main

scripts/start_local_debugger_server.js:30–61  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

28const debuggerStaticFile = {};
29
30function main(args) {
31 const port = parseInt(args['port']);
32 const version = args['version'];
33
34 app.get('/*', (req, res) => {
35 // Remove leading '/'.
36 let filePath = req.path.substring(1);
37 if (filePath === '') {
38 filePath = 'index.html';
39 }
40
41 // Send file from the unzipped tfjs-debugger bundle from memory.
42 if (debuggerStaticFile[filePath]) {
43 res.contentType(path.basename(filePath));
44 res.send(debuggerStaticFile[filePath]);
45 }
46 // Send other files from the local file system.
47 else {
48 const tfjsRoot = __dirname.replace('/scripts', '/');
49 res.sendFile(tfjsRoot + filePath);
50 }
51 });
52
53 app.listen(port, async () => {
54 // On server start-up, fetch the zipped debugger bundle and unzip in memory.
55 console.log('Fetching tfjs debugger static files...');
56 await fetchAndUnzipTfjsDebuggerBundle(version);
57 console.log('Done');
58 console.log(`Local debugger server started at http://localhost:${
59 port}/?bv__0=Local%20build&bv__1=`);
60 });
61}
62
63async function fetchAndUnzipTfjsDebuggerBundle(version) {
64 let resp;

Callers 1

Calls 3

logMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…