* @param {Map } langKeys * @param {Array } filesPath * @param {Database} database
(langKeys, filesPath, database)
| 96 | * @param {Database} database |
| 97 | */ |
| 98 | function startThread(langKeys, filesPath, database) { |
| 99 | const worker = new Worker(fileURLToPath(import.meta.url), { |
| 100 | workerData: { langKeys, filesPath } |
| 101 | }); |
| 102 | return new Promise((resolve, reject) => { |
| 103 | worker.on("message", (msg) => { |
| 104 | const { type, data } = msg; |
| 105 | if (type === "key") { |
| 106 | database.keysMap.set(data, true); |
| 107 | } |
| 108 | if (type === "exit") { |
| 109 | console.log(`Thread ID: ${data} \tScan finished!`); |
| 110 | resolve(null); |
| 111 | } |
| 112 | }); |
| 113 | }); |
| 114 | } |
| 115 | |
| 116 | async function mainThread() { |
| 117 | console.log("process.argv:", process.argv); |
no test coverage detected