node-automator 1.4.15 → 1.4.17

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.
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const { get_fst_file, get_full_path, move } = require('../utils/file_tool');
3
3
  const { BaseCommand } = require("./base");
4
+ const { readFileSync } = require('fs');
4
5
 
5
6
  class CompressCommand extends BaseCommand {
6
7
  async execute() {
@@ -8,7 +9,6 @@ class CompressCommand extends BaseCommand {
8
9
  const data = this.selfData;
9
10
  const src = get_fst_file(data.src);
10
11
  const dst = get_full_path(data.dst, "FILE");
11
- const tmp = path.join(this.shareData.AUTOMATOR_SCRATCH, path.basename(src));
12
12
  let format = data.format;
13
13
  if (!format) {
14
14
  format = dst.split(".").pop();
@@ -18,9 +18,9 @@ class CompressCommand extends BaseCommand {
18
18
  format = "jpeg";
19
19
  }
20
20
  const options = data.options;
21
- await sharp(src)[format](options)
22
- .toFile(tmp);
23
- await move(tmp, path.dirname(dst), undefined, { quiet: true });
21
+ const fileContent = readFileSync(src);
22
+ await sharp(fileContent)[format](options)
23
+ .toFile(dst);
24
24
  }
25
25
  }
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-automator",
3
- "version": "1.4.15",
3
+ "version": "1.4.17",
4
4
  "description": "Execute automation with yaml configuration(compatible with json)",
5
5
  "main": "index.js",
6
6
  "repository": {