@codernex/nexpress 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,6 +13,8 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
const homeDir = os.homedir();
|
|
15
15
|
const acceptableArgs = ["--input", "--output", "--quality", "--help"];
|
|
16
|
+
const workerFileName = `image-processor${path.extname(__filename)}`;
|
|
17
|
+
const workerPath = path.join(__dirname, workerFileName);
|
|
16
18
|
const args = process.argv.slice(2); // Use slice instead of splice
|
|
17
19
|
const filteredArgs = args.filter((p) => {
|
|
18
20
|
const [key] = p.split("=");
|
|
@@ -77,8 +79,9 @@ const allImages = fs.readdirSync(inputPath).filter((file) => {
|
|
|
77
79
|
allImages.forEach((fileName) => {
|
|
78
80
|
console.log("Processing:", fileName);
|
|
79
81
|
const workerId = uuidV4();
|
|
80
|
-
const worker = new Worker(
|
|
82
|
+
const worker = new Worker(workerPath, {
|
|
81
83
|
// Use .js file
|
|
84
|
+
execArgv: process.execArgv,
|
|
82
85
|
workerData: {
|
|
83
86
|
input: path.join(inputPath, fileName),
|
|
84
87
|
output: outputPath,
|