PageSourceSearch

https://zalamo.com/js/workers/new/cliworker2.js

js zalamo.com collected 2026-10-03 22:07:32 UTC 1,853 bytes, 74 lines download raw bytes

1console.log('cli worker enabled');
2var fileLoaded = false, toCall = [], FS;
3this['Module'] = {
4    'noInitialRun': true,
5    TOTAL_MEMORY: 33554432*8,
6
7    // noExitRuntime : true
8};
9var Module = this['Module'];
10Module['print'] = function (a) {
11    console.log(a);
12    self['postMessage'](JSON.stringify({'command': 'stdout', 'contents': a}));
13}
14Module['printErr'] = function (a) {
15    console.log(a);
16    self['postMessage'](JSON.stringify({'command': 'stderr', 'contents': a}));
17}
18// Module.TOTAL_MEMORY = 33554432;
19
20var currentFile = "";
21onmessage = function (e) {
22    console.log(e.data);
23    if (typeof e.data == 'string') {
24        var data = JSON.parse(e.data);
25    } else {
26        data = e.data;
27    }
28    switch (data.command) {
29        case "addFile":
30            FS.mkdir('/working');
31
32            FS.mount(WORKERFS, {
33                files: [data.file] // Array of File objects or FileList
34            }, '/working');
35            break;
36        case "addBlob":
37            FS.mkdir('/working');
38
39            FS.mount(WORKERFS, {
40                blobs: [{name: data.name, data: data.file}]
41
42            }, '/working');
43
44
45            break;
46        case "run":
47            runCli(data['args'], data.outputFile);
48
49    }
50
51};
52
53function runCli(args, outputFile) {
54    if (runDependencies > 0) {
55        setTimeout(function () {
56            runCli(args, outputFile);
57        }, 100);
58        return false;
59    }
60    console.log('run CLI', args[0], args[1], args[2], outputFile);
61    console.log(FS.readdir("/working"));
62    Module["callMain"](args);
63    f = FS.readFile(outputFile)
64    postMessage({
65        type: 'fromRun',
66        command: args,
67        file: f
68    });
69    FS.unlink(outputFile);
70
71    Module['calledRun'] == false;
72    fileLoaded = false;
73    close();
74}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.