@quatrain/worker 1.2.10 → 1.2.11

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/Helpers.d.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  * General utility class providing common static helpers for workers.
3
3
  */
4
4
  export declare class Helpers {
5
+ private static _ffmpegPathPromise;
5
6
  /** Default absolute path to the system's FFmpeg binary. */
6
- static FFMPEG: Promise<string>;
7
+ static get FFMPEG(): Promise<string>;
7
8
  /**
8
9
  * Generate a thubnail from a video file at given frame position
9
10
  * @param videoPath path to video file
package/dist/Helpers.js CHANGED
@@ -6,8 +6,14 @@ const Worker_1 = require("./Worker");
6
6
  * General utility class providing common static helpers for workers.
7
7
  */
8
8
  class Helpers {
9
+ static _ffmpegPathPromise = null;
9
10
  /** Default absolute path to the system's FFmpeg binary. */
10
- static FFMPEG = Worker_1.Worker.getSystemCommandPath('ffmpeg');
11
+ static get FFMPEG() {
12
+ if (!this._ffmpegPathPromise) {
13
+ this._ffmpegPathPromise = Worker_1.Worker.getSystemCommandPath('ffmpeg').catch(() => 'ffmpeg');
14
+ }
15
+ return this._ffmpegPathPromise;
16
+ }
11
17
  /**
12
18
  * Generate a thubnail from a video file at given frame position
13
19
  * @param videoPath path to video file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/worker",
3
- "version": "1.2.10",
3
+ "version": "1.2.11",
4
4
  "description": "Container Worker helpers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/Helpers.ts CHANGED
@@ -5,8 +5,15 @@ import path from 'node:path'
5
5
  * General utility class providing common static helpers for workers.
6
6
  */
7
7
  export class Helpers {
8
+ private static _ffmpegPathPromise: Promise<string> | null = null
9
+
8
10
  /** Default absolute path to the system's FFmpeg binary. */
9
- static FFMPEG = Worker.getSystemCommandPath('ffmpeg')
11
+ static get FFMPEG(): Promise<string> {
12
+ if (!this._ffmpegPathPromise) {
13
+ this._ffmpegPathPromise = Worker.getSystemCommandPath('ffmpeg').catch(() => 'ffmpeg')
14
+ }
15
+ return this._ffmpegPathPromise
16
+ }
10
17
 
11
18
  /**
12
19
  * Generate a thubnail from a video file at given frame position