homebridge-plugin-utils 1.35.0 → 2.0.0

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.
Files changed (198) hide show
  1. package/README.md +130 -2
  2. package/build/eslint-plugin/README.md +164 -0
  3. package/build/eslint-plugin/config.mjs +308 -0
  4. package/build/eslint-plugin/index.mjs +7 -0
  5. package/build/eslint-plugin/plugin.mjs +46 -0
  6. package/build/eslint-plugin/rules/blank-line-after-open-brace.mjs +137 -0
  7. package/build/eslint-plugin/rules/blank-line-after-open-brace.test.mjs +112 -0
  8. package/build/eslint-plugin/rules/comment-style.mjs +190 -0
  9. package/build/eslint-plugin/rules/comment-style.test.mjs +190 -0
  10. package/build/eslint-plugin/rules/enforce-node-protocol.mjs +114 -0
  11. package/build/eslint-plugin/rules/enforce-node-protocol.test.mjs +116 -0
  12. package/build/eslint-plugin/rules/paren-comparisons-in-logical.mjs +94 -0
  13. package/build/eslint-plugin/rules/paren-comparisons-in-logical.test.mjs +107 -0
  14. package/build/eslint-plugin/rules/split-type-imports.mjs +354 -0
  15. package/build/eslint-plugin/rules/split-type-imports.test.mjs +268 -0
  16. package/build/eslint-plugin/test-setup.mjs +21 -0
  17. package/build/fs-ops.mjs +184 -0
  18. package/build/tsconfig.json +18 -3
  19. package/dist/backpressure.d.ts +94 -45
  20. package/dist/backpressure.js +229 -93
  21. package/dist/backpressure.js.map +1 -1
  22. package/dist/cli/index.d.ts +95 -0
  23. package/dist/cli/index.js +355 -0
  24. package/dist/cli/index.js.map +1 -0
  25. package/dist/clock-double.d.ts +93 -0
  26. package/dist/clock-double.js +141 -0
  27. package/dist/clock-double.js.map +1 -0
  28. package/dist/clock.d.ts +39 -0
  29. package/dist/clock.js +34 -0
  30. package/dist/clock.js.map +1 -0
  31. package/dist/eslint-plugin/config.d.mts +193 -0
  32. package/dist/eslint-plugin/index.d.mts +2 -0
  33. package/dist/eslint-plugin/plugin.d.mts +87 -0
  34. package/dist/eslint-plugin/rules/blank-line-after-open-brace.d.mts +19 -0
  35. package/dist/eslint-plugin/rules/comment-style.d.mts +15 -0
  36. package/dist/eslint-plugin/rules/enforce-node-protocol.d.mts +18 -0
  37. package/dist/eslint-plugin/rules/paren-comparisons-in-logical.d.mts +15 -0
  38. package/dist/eslint-plugin/rules/split-type-imports.d.mts +16 -0
  39. package/dist/featureOptions-docs.d.ts +96 -0
  40. package/dist/featureOptions-docs.js +193 -0
  41. package/dist/featureOptions-docs.js.map +1 -0
  42. package/dist/featureOptions.d.ts +674 -0
  43. package/dist/featureOptions.js +870 -0
  44. package/dist/featureOptions.js.map +1 -0
  45. package/dist/ffmpeg/codecs.d.ts +256 -72
  46. package/dist/ffmpeg/codecs.js +477 -262
  47. package/dist/ffmpeg/codecs.js.map +1 -1
  48. package/dist/ffmpeg/dgram-util.d.ts +46 -0
  49. package/dist/ffmpeg/dgram-util.js +38 -0
  50. package/dist/ffmpeg/dgram-util.js.map +1 -0
  51. package/dist/ffmpeg/exec.d.ts +83 -64
  52. package/dist/ffmpeg/exec.js +77 -86
  53. package/dist/ffmpeg/exec.js.map +1 -1
  54. package/dist/ffmpeg/fmp4.d.ts +49 -2
  55. package/dist/ffmpeg/fmp4.js +47 -11
  56. package/dist/ffmpeg/fmp4.js.map +1 -1
  57. package/dist/ffmpeg/hap-enums.d.ts +214 -0
  58. package/dist/ffmpeg/hap-enums.js +92 -0
  59. package/dist/ffmpeg/hap-enums.js.map +1 -0
  60. package/dist/ffmpeg/index.d.ts +16 -9
  61. package/dist/ffmpeg/index.js +6 -0
  62. package/dist/ffmpeg/index.js.map +1 -1
  63. package/dist/ffmpeg/mp4-assembler.d.ts +120 -0
  64. package/dist/ffmpeg/mp4-assembler.js +387 -0
  65. package/dist/ffmpeg/mp4-assembler.js.map +1 -0
  66. package/dist/ffmpeg/mp4-parser.d.ts +94 -0
  67. package/dist/ffmpeg/mp4-parser.js +130 -0
  68. package/dist/ffmpeg/mp4-parser.js.map +1 -0
  69. package/dist/ffmpeg/options.d.ts +62 -149
  70. package/dist/ffmpeg/options.js +608 -499
  71. package/dist/ffmpeg/options.js.map +1 -1
  72. package/dist/ffmpeg/process.d.ts +142 -96
  73. package/dist/ffmpeg/process.js +406 -278
  74. package/dist/ffmpeg/process.js.map +1 -1
  75. package/dist/ffmpeg/record.d.ts +302 -188
  76. package/dist/ffmpeg/record.js +408 -567
  77. package/dist/ffmpeg/record.js.map +1 -1
  78. package/dist/ffmpeg/recording-process-double.d.ts +144 -0
  79. package/dist/ffmpeg/recording-process-double.js +168 -0
  80. package/dist/ffmpeg/recording-process-double.js.map +1 -0
  81. package/dist/ffmpeg/rtp-parser.d.ts +70 -0
  82. package/dist/ffmpeg/rtp-parser.js +77 -0
  83. package/dist/ffmpeg/rtp-parser.js.map +1 -0
  84. package/dist/ffmpeg/rtp.d.ts +198 -141
  85. package/dist/ffmpeg/rtp.js +473 -251
  86. package/dist/ffmpeg/rtp.js.map +1 -1
  87. package/dist/ffmpeg/settings.d.ts +5 -2
  88. package/dist/ffmpeg/settings.js +20 -5
  89. package/dist/ffmpeg/settings.js.map +1 -1
  90. package/dist/ffmpeg/stream.d.ts +57 -107
  91. package/dist/ffmpeg/stream.js +121 -150
  92. package/dist/ffmpeg/stream.js.map +1 -1
  93. package/dist/formatters.d.ts +106 -0
  94. package/dist/formatters.js +174 -0
  95. package/dist/formatters.js.map +1 -0
  96. package/dist/homebridge-enums.d.ts +30 -0
  97. package/dist/homebridge-enums.js +17 -0
  98. package/dist/homebridge-enums.js.map +1 -0
  99. package/dist/index.d.ts +12 -6
  100. package/dist/index.js +7 -2
  101. package/dist/index.js.map +1 -1
  102. package/dist/logclient/auth.d.ts +114 -0
  103. package/dist/logclient/auth.js +199 -0
  104. package/dist/logclient/auth.js.map +1 -0
  105. package/dist/logclient/cli-run.d.ts +76 -0
  106. package/dist/logclient/cli-run.js +639 -0
  107. package/dist/logclient/cli-run.js.map +1 -0
  108. package/dist/logclient/cli.d.ts +3 -0
  109. package/dist/logclient/cli.js +97 -0
  110. package/dist/logclient/cli.js.map +1 -0
  111. package/dist/logclient/client.d.ts +145 -0
  112. package/dist/logclient/client.js +600 -0
  113. package/dist/logclient/client.js.map +1 -0
  114. package/dist/logclient/config.d.ts +173 -0
  115. package/dist/logclient/config.js +199 -0
  116. package/dist/logclient/config.js.map +1 -0
  117. package/dist/logclient/endpoints.d.ts +54 -0
  118. package/dist/logclient/endpoints.js +73 -0
  119. package/dist/logclient/endpoints.js.map +1 -0
  120. package/dist/logclient/filter.d.ts +45 -0
  121. package/dist/logclient/filter.js +51 -0
  122. package/dist/logclient/filter.js.map +1 -0
  123. package/dist/logclient/frame.d.ts +93 -0
  124. package/dist/logclient/frame.js +203 -0
  125. package/dist/logclient/frame.js.map +1 -0
  126. package/dist/logclient/index.d.ts +31 -0
  127. package/dist/logclient/index.js +12 -0
  128. package/dist/logclient/index.js.map +1 -0
  129. package/dist/logclient/parser.d.ts +211 -0
  130. package/dist/logclient/parser.js +393 -0
  131. package/dist/logclient/parser.js.map +1 -0
  132. package/dist/logclient/rest.d.ts +41 -0
  133. package/dist/logclient/rest.js +111 -0
  134. package/dist/logclient/rest.js.map +1 -0
  135. package/dist/logclient/settings.d.ts +15 -0
  136. package/dist/logclient/settings.js +64 -0
  137. package/dist/logclient/settings.js.map +1 -0
  138. package/dist/logclient/socket-double.d.ts +201 -0
  139. package/dist/logclient/socket-double.js +384 -0
  140. package/dist/logclient/socket-double.js.map +1 -0
  141. package/dist/logclient/socket.d.ts +257 -0
  142. package/dist/logclient/socket.js +620 -0
  143. package/dist/logclient/socket.js.map +1 -0
  144. package/dist/logclient/stitch.d.ts +83 -0
  145. package/dist/logclient/stitch.js +146 -0
  146. package/dist/logclient/stitch.js.map +1 -0
  147. package/dist/logclient/time-expression.d.ts +42 -0
  148. package/dist/logclient/time-expression.js +181 -0
  149. package/dist/logclient/time-expression.js.map +1 -0
  150. package/dist/logclient/time-window.d.ts +38 -0
  151. package/dist/logclient/time-window.js +53 -0
  152. package/dist/logclient/time-window.js.map +1 -0
  153. package/dist/logclient/types.d.ts +107 -0
  154. package/dist/logclient/types.js +6 -0
  155. package/dist/logclient/types.js.map +1 -0
  156. package/dist/mqttClient.d.ts +287 -0
  157. package/dist/mqttClient.js +433 -0
  158. package/dist/mqttClient.js.map +1 -0
  159. package/dist/service.d.ts +64 -15
  160. package/dist/service.js +93 -66
  161. package/dist/service.js.map +1 -1
  162. package/dist/ui/featureOptions.js +870 -0
  163. package/dist/ui/featureOptions.js.map +1 -0
  164. package/dist/ui/formatters.js +174 -0
  165. package/dist/ui/formatters.js.map +1 -0
  166. package/dist/ui/pluginConfigSession.mjs +141 -0
  167. package/dist/ui/webUi-featureOptions/categoryState.mjs +135 -0
  168. package/dist/ui/webUi-featureOptions/effects/keyboard.mjs +61 -0
  169. package/dist/ui/webUi-featureOptions/effects/persist.mjs +226 -0
  170. package/dist/ui/webUi-featureOptions/effects/theme.mjs +398 -0
  171. package/dist/ui/webUi-featureOptions/effects/tokens.mjs +152 -0
  172. package/dist/ui/webUi-featureOptions/rendering.mjs +431 -0
  173. package/dist/ui/webUi-featureOptions/selectors.mjs +360 -0
  174. package/dist/ui/webUi-featureOptions/state.mjs +319 -0
  175. package/dist/ui/webUi-featureOptions/store.mjs +181 -0
  176. package/dist/ui/webUi-featureOptions/utils.mjs +200 -0
  177. package/dist/ui/webUi-featureOptions/views/connectionError.mjs +152 -0
  178. package/dist/ui/webUi-featureOptions/views/deviceInfo.mjs +80 -0
  179. package/dist/ui/webUi-featureOptions/views/header.mjs +77 -0
  180. package/dist/ui/webUi-featureOptions/views/nav.mjs +327 -0
  181. package/dist/ui/webUi-featureOptions/views/options.mjs +521 -0
  182. package/dist/ui/webUi-featureOptions/views/search.mjs +395 -0
  183. package/dist/ui/webUi-featureOptions.mjs +677 -0
  184. package/dist/ui/webUi.mjs +192 -87
  185. package/dist/util.d.ts +602 -45
  186. package/dist/util.js +783 -78
  187. package/dist/util.js.map +1 -1
  188. package/package.json +33 -15
  189. package/build/eslint-rules.mjs +0 -511
  190. package/dist/featureoptions.d.ts +0 -264
  191. package/dist/featureoptions.js +0 -480
  192. package/dist/featureoptions.js.map +0 -1
  193. package/dist/mqttclient.d.ts +0 -178
  194. package/dist/mqttclient.js +0 -310
  195. package/dist/mqttclient.js.map +0 -1
  196. package/dist/ui/featureoptions.js +0 -480
  197. package/dist/ui/featureoptions.js.map +0 -1
  198. package/dist/ui/webUi-featureoptions.mjs +0 -3765
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../src/ffmpeg/codecs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAA0B,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,iFAAiF;AACjF,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAyB1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAO,YAAY;IAEvB;;OAEG;IACa,UAAU,CAAS;IAE3B,cAAc,CAAU;IACxB,OAAO,CAAU;IACjB,WAAW,CAAU;IACrB,cAAc,CAAU;IACf,GAAG,CAAoC;IACvC,YAAY,CAAmE;IAC/E,cAAc,CAAc;IAE7C;;OAEG;IACa,OAAO,CAAU;IAEjC;;;;OAIG;IACH,YAAY,OAAiB;QAE3B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;Q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K,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Single source of truth for the `"ipv4"` / `"ipv6"` -> `node:dgram` translations the FFmpeg subsystem needs.
3
+ *
4
+ * Every call site in the FFmpeg subsystem that needs the ipFamily -> node:dgram translation routes through the table lookups exported here, rather than
5
+ * hand-rolling `ipFamily === "ipv6" ? "udp6" : "udp4"` or `isIPv6 ? "::1" : "127.0.0.1"` inline. Keeping the mapping centralized means a future addition
6
+ * (dual-stack socket types, SO_REUSEADDR flags, alternative loopback addresses in constrained test environments) has exactly one file to update, and
7
+ * consumers - production or test - share the same vocabulary.
8
+ *
9
+ * @module
10
+ */
11
+ import type { Socket } from "node:dgram";
12
+ /**
13
+ * The two IP families the FFmpeg subsystem supports. Centralized here so consumers in `rtp.ts`, `stream.ts`, and the test fixtures share the same union rather than
14
+ * re-declaring inline unions at every init-type boundary.
15
+ *
16
+ * @category FFmpeg
17
+ */
18
+ export type IpFamily = "ipv4" | "ipv6";
19
+ declare const LOOPBACK_ADDRESS: {
20
+ readonly ipv4: "127.0.0.1";
21
+ readonly ipv6: "::1";
22
+ };
23
+ /**
24
+ * Resolve the loopback address string for the supplied IP family. The returned literal is suitable for passing to `socket.bind(port, address)` or
25
+ * `socket.send(..., address, ...)`.
26
+ *
27
+ * @param ipFamily - The IP family to resolve.
28
+ *
29
+ * @returns `"127.0.0.1"` for `"ipv4"` or `"::1"` for `"ipv6"`.
30
+ *
31
+ * @category FFmpeg
32
+ */
33
+ export declare function loopbackAddress(ipFamily: IpFamily): (typeof LOOPBACK_ADDRESS)[IpFamily];
34
+ /**
35
+ * Create a `node:dgram` socket for the supplied IP family. Equivalent to `createSocket("udp4")` / `createSocket("udp6")` but routes the family -> socket-type lookup
36
+ * through the single table above, so every call site shares one mapping.
37
+ *
38
+ * @param ipFamily - The IP family for the new socket.
39
+ *
40
+ * @returns A fresh unbound {@link Socket}.
41
+ *
42
+ * @category FFmpeg
43
+ */
44
+ export declare function createDgramSocket(ipFamily: IpFamily): Socket;
45
+ export {};
46
+ //# sourceMappingURL=dgram-util.d.ts.map
@@ -0,0 +1,38 @@
1
+ /* Copyright(C) 2017-2026, HJD (https://github.com/hjdhjd). All rights reserved.
2
+ *
3
+ * ffmpeg/dgram-util.ts: Shared UDP socket helpers and IP-family translation tables for the FFmpeg subsystem.
4
+ */
5
+ import { createSocket } from "node:dgram";
6
+ // `node:dgram` socket-type strings keyed by IP family. The union is narrowed by the `as const` so downstream types (e.g., the parameter to `createSocket`) retain
7
+ // the literal types `"udp4"` / `"udp6"` through the lookup.
8
+ const DGRAM_SOCKET_TYPE = { ipv4: "udp4", ipv6: "udp6" };
9
+ // Loopback addresses keyed by IP family. Note that `"::1"` is the IPv6 loopback specifically, not the any-address form - sockets bound here accept only local-host
10
+ // traffic, which matches every current consumer's intent (health probes, port reservations, test fixtures).
11
+ const LOOPBACK_ADDRESS = { ipv4: "127.0.0.1", ipv6: "::1" };
12
+ /**
13
+ * Resolve the loopback address string for the supplied IP family. The returned literal is suitable for passing to `socket.bind(port, address)` or
14
+ * `socket.send(..., address, ...)`.
15
+ *
16
+ * @param ipFamily - The IP family to resolve.
17
+ *
18
+ * @returns `"127.0.0.1"` for `"ipv4"` or `"::1"` for `"ipv6"`.
19
+ *
20
+ * @category FFmpeg
21
+ */
22
+ export function loopbackAddress(ipFamily) {
23
+ return LOOPBACK_ADDRESS[ipFamily];
24
+ }
25
+ /**
26
+ * Create a `node:dgram` socket for the supplied IP family. Equivalent to `createSocket("udp4")` / `createSocket("udp6")` but routes the family -> socket-type lookup
27
+ * through the single table above, so every call site shares one mapping.
28
+ *
29
+ * @param ipFamily - The IP family for the new socket.
30
+ *
31
+ * @returns A fresh unbound {@link Socket}.
32
+ *
33
+ * @category FFmpeg
34
+ */
35
+ export function createDgramSocket(ipFamily) {
36
+ return createSocket(DGRAM_SOCKET_TYPE[ipFamily]);
37
+ }
38
+ //# sourceMappingURL=dgram-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dgram-util.js","sourceRoot":"","sources":["../../src/ffmpeg/dgram-util.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAU1C,kKAAkK;AAClK,4DAA4D;AAC5D,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAW,CAAC;AAElE,mKAAmK;AACnK,4GAA4G;AAC5G,MAAM,gBAAgB,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAW,CAAC;AAErE;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,QAAkB;IAEhD,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAElD,OAAO,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -1,108 +1,127 @@
1
1
  /**
2
- * Executes arbitrary FFmpeg commands and returns the results.
2
+ * One-shot FFmpeg execution with composed signal lifetime.
3
3
  *
4
- * This module exposes the `FfmpegExec` class, which extends the core process handling of FFmpeg to support running custom command-line operations. It enables developers
5
- * to run FFmpeg commands from Node.js, capture both standard output and error streams, handle process exit codes, and optionally supply input via stdin.
4
+ * This module defines `FfmpegExec`, the specialization of {@link FfmpegProcess} for the "feed a buffer, collect output, get an exit code" shape. Construction spawns
5
+ * the child immediately (per the base class's spawn-on-construction contract); the composed `this.signal` governs its lifetime. The class narrows the inherited public
6
+ * `stdout` to `never` because stdout is drained internally into {@link FfmpegExec.stdoutBuffer} and a concurrent external reader would race.
6
7
  *
7
- * Intended for plugin developers and advanced users, this module is ideal for scenarios where you need direct control over FFmpeg execution—such as probing media,
8
- * transcoding, or automation tasks—while still benefiting from structured result handling and robust error logging.
8
+ * Two usage shapes:
9
9
  *
10
- * Key features:
10
+ * - **Canned input.** Pass `stdin: Buffer` in the init options. The buffer is written to FFmpeg's stdin and the stream is ended on the next microtask after spawn, so
11
+ * one-liner callers do not have to touch the stdin stream at all.
12
+ * - **Streaming input.** Omit the `stdin` init option and use the inherited `stdin` writable directly. Call `exec.stdin.end()` when done.
11
13
  *
12
- * - Execute any FFmpeg command with custom arguments.
13
- * - Capture stdout, stderr, and exit codes as structured results.
14
- * - Optional stdin data injection.
15
- * - Configurable error logging.
14
+ * Both patterns converge on {@link FfmpegExec.result}, which bundles the collected stdout, exit code, exit signal, and accumulated stderr log.
16
15
  *
17
16
  * @module
18
17
  */
19
- import type { FfmpegOptions } from "./options.js";
20
- import { FfmpegProcess } from "./process.js";
21
- import type { Nullable } from "../util.js";
18
+ import type { FfmpegOptions } from "./options.ts";
19
+ import { FfmpegProcess } from "./process.ts";
20
+ import type { FfmpegProcessInit } from "./process.ts";
21
+ import type { Nullable } from "../util.ts";
22
22
  /**
23
- * Describes the result of executing an FFmpeg process.
23
+ * Construction-time options for {@link FfmpegExec}.
24
24
  *
25
- * @property exitCode - The process exit code, or `null` if not available.
26
- * @property stderr - The standard error output as a Buffer.
27
- * @property stdout - The standard output as a Buffer.
25
+ * @property stdin - Optional. When provided, the buffer is written to FFmpeg's standard input and the stream is ended on the next microtask after spawn. Covers the
26
+ * overwhelmingly common "feed this buffer, get stdout back" pattern without forcing callers to reach for the streaming-stdin API. Omit to drive
27
+ * stdin manually via the inherited `stdin` writable.
28
+ *
29
+ * @see FfmpegProcessInit
30
+ *
31
+ * @category FFmpeg
32
+ */
33
+ export interface FfmpegExecInit extends FfmpegProcessInit {
34
+ stdin?: Buffer;
35
+ }
36
+ /**
37
+ * Structured result returned by {@link FfmpegExec.result}.
38
+ *
39
+ * @property exitCode - The process exit code, or `null` when the process was terminated by a signal.
40
+ * @property exitSignal - The signal name (e.g., `"SIGKILL"`) that terminated the process, or `null` when the process exited normally.
41
+ * @property stderrLog - A snapshot of the accumulated stderr lines at the moment `exited` resolved. Readonly because {@link FfmpegProcess.stderrLog} itself is
42
+ * readonly and this bundle is a pass-through view rather than an independent copy.
43
+ * @property stdout - The complete stdout bytes collected over the lifetime of the process.
28
44
  *
29
45
  * @category FFmpeg
30
46
  */
31
- export interface ProcessResult {
47
+ export interface ExecResult {
32
48
  exitCode: Nullable<number>;
33
- stderr: Buffer;
49
+ exitSignal: Nullable<NodeJS.Signals>;
50
+ stderrLog: readonly string[];
34
51
  stdout: Buffer;
35
52
  }
36
53
  /**
37
- * Executes arbitrary FFmpeg commands and returns the results.
54
+ * One-shot FFmpeg execution. Extends {@link FfmpegProcess} directly, inheriting its spawn-on-construction and signal-driven teardown semantics and adding the small
55
+ * surface that the "feed bytes, read bytes, get exit status" pattern needs.
56
+ *
57
+ * The public `stdout` type is narrowed to `never` via `declare`. Callers read collected output through {@link FfmpegExec.stdoutBuffer} (the raw Buffer) or
58
+ * {@link FfmpegExec.result} (the bundled result with exit context). The narrowing is a type-level contract; pure-JS callers that reach past the types still see the
59
+ * underlying Readable, but a concurrent external reader would race with our internal collector - "do not do that" is the appropriate enforcement bar for a TypeScript
60
+ * library.
61
+ *
62
+ * @example
38
63
  *
39
- * This class extends `FfmpegProcess` to provide a simple interface for running FFmpeg with custom command-line arguments, capturing both standard output and standard
40
- * error, and returning process results in a structured format. Intended for plugin authors and advanced users who need to programmatically execute FFmpeg commands and
41
- * capture their results.
64
+ * ```ts
65
+ * // Canned input, one-shot.
66
+ * const exec = new FfmpegExec(options, { args, stdin: inputBuffer, signal });
67
+ * const { exitCode, stdout } = await exec.result();
68
+ * ```
42
69
  *
43
70
  * @example
44
71
  *
45
72
  * ```ts
46
- * const exec = new FfmpegExec(options, ["-version"]);
47
- * const result = await exec.exec();
73
+ * // Streaming input - write stdin progressively before awaiting the result.
74
+ * const exec = new FfmpegExec(options, { args, signal });
48
75
  *
49
- * if(result && result.exitCode === 0) {
76
+ * exec.stdin.write(chunk1);
77
+ * exec.stdin.write(chunk2);
78
+ * exec.stdin.end();
50
79
  *
51
- * console.log(result.stdout.toString());
52
- * }
80
+ * const { exitCode, stdout } = await exec.result();
53
81
  * ```
54
82
  *
55
83
  * @see FfmpegProcess
56
- * @see {@link https://ffmpeg.org/documentation.html | FFmpeg Documentation}
57
84
  *
58
85
  * @category FFmpeg
59
86
  */
60
87
  export declare class FfmpegExec extends FfmpegProcess {
61
- private isLoggingErrors;
88
+ #private;
62
89
  /**
63
- * Creates a new instance of `FfmpegExec`.
64
- *
65
- * @param options - The options used to configure FFmpeg execution.
66
- * @param commandLineArgs - Optional. Command-line arguments to pass to the FFmpeg process.
67
- * @param logErrors - Optional. If `true`, errors will be logged; otherwise, they will be suppressed. Defaults to `true`.
68
- *
69
- * @example
70
- *
71
- * ```ts
72
- * const exec = new FfmpegExec(options, ["-i", "input.mp4", "-f", "null", "-"]);
73
- * ```
90
+ * stdout is consumed internally by the collector loop. The public type is narrowed to `never` so TypeScript callers cannot accidentally attach a second reader.
74
91
  */
75
- constructor(options: FfmpegOptions, commandLineArgs?: string[], logErrors?: boolean);
92
+ readonly stdout: never;
76
93
  /**
77
- * Runs the FFmpeg process and returns the result, including exit code, stdout, and stderr.
94
+ * Promise that resolves with every byte the child wrote to stdout before its stdout pipe closed. The pipe closes for any reason - natural EOF after a clean exit,
95
+ * abort-driven kill, synthetic stream destroy - and the promise settles the same way: whatever the consumer absorbed before close, byte-for-byte.
78
96
  *
79
- * If `stdinData` is provided, it will be written to the process's standard input before execution. Returns `null` if the process fails to start.
97
+ * Resolves with `Buffer.alloc(0)` only when the underlying readable surfaces a stream error (the catch branch in `#collectStdout`); the abort-kill
98
+ * path does not normally produce a stream error, so an aborted run yields whatever bytes happened to arrive before the kill landed - which may be all of them, some
99
+ * of them, or none of them.
80
100
  *
81
- * @param stdinData - Optional. Data to write to FFmpeg's standard input.
82
- *
83
- * @returns A promise that resolves to a `ProcessResult` object containing the exit code, stdout, and stderr, or `null` if the process could not be started.
84
- *
85
- * @example
86
- *
87
- * ```ts
88
- * const exec = new FfmpegExec(options, ["-i", "input.wav", "output.mp3"]);
89
- * const result = await exec.exec();
101
+ * This promise is the data channel only. To discriminate "the child wrote nothing" from "the run was aborted before the child could write anything," consult
102
+ * {@link FfmpegExec.exited} (`exitCode` / `exitSignal`) and {@link FfmpegProcess.signal} (`signal.reason`). Those are the single source of truth for process
103
+ * disposition; an empty buffer carries no disposition meaning on its own.
104
+ */
105
+ readonly stdoutBuffer: Promise<Buffer>;
106
+ /**
107
+ * Construct and spawn a new FFmpeg execution.
90
108
  *
91
- * if(result) {
109
+ * Spawning happens synchronously as part of construction. When `init.stdin` is supplied, the buffer is written to stdin and the stream is ended on the next
110
+ * microtask, giving synchronous post-construction caller code (e.g., attaching a drain listener) a chance to run before stdin I/O begins.
92
111
  *
93
- * console.log("Exit code:", result.exitCode);
94
- * console.log("FFmpeg output:", result.stdout.toString());
95
- * }
96
- * ```
112
+ * @param options - Shared {@link FfmpegOptions} configuration (codec support, logger, debug flag, name).
113
+ * @param init - Optional init options. See {@link FfmpegExecInit}.
97
114
  */
98
- exec(stdinData?: Buffer): Promise<Nullable<ProcessResult>>;
115
+ constructor(options: FfmpegOptions, init?: FfmpegExecInit);
99
116
  /**
100
- * Logs errors encountered during FFmpeg execution.
117
+ * Await the process to completion and return the bundled result.
101
118
  *
102
- * If error logging is disabled, this method will do nothing. Otherwise, it calls the parent implementation for standard logging behavior.
119
+ * Resolves once both the stdout collector and the base class's `exited` promise settle. Rejects with the same reason `exited` would reject with (today, only when
120
+ * the child never spawned - e.g., ENOENT). On any normal exit, including non-zero exit codes, this method resolves; callers discriminate outcomes by inspecting
121
+ * `exitCode` and `exitSignal` in the result, or the derived `hasError` getter on the instance.
103
122
  *
104
- * @param exitCode - The exit code returned by the FFmpeg process.
105
- * @param signal - The signal used to terminate the process, if any.
123
+ * @returns A promise resolving to an {@link ExecResult} bundling stdout, exit code, exit signal, and the accumulated stderr log.
106
124
  */
107
- protected logFfmpegError(exitCode: Nullable<number>, signal: Nullable<NodeJS.Signals>): void;
125
+ result(): Promise<ExecResult>;
108
126
  }
127
+ //# sourceMappingURL=exec.d.ts.map
@@ -1,123 +1,114 @@
1
1
  /* Copyright(C) 2017-2026, HJD (https://github.com/hjdhjd). All rights reserved.
2
2
  *
3
- * ffmpeg/exec.ts: Execute arbitrary FFmpeg commands and return the results.
3
+ * ffmpeg/exec.ts: One-shot FFmpeg execution - feed optional stdin, collect stdout, capture exit status.
4
4
  */
5
5
  import { FfmpegProcess } from "./process.js";
6
+ import { buffer } from "node:stream/consumers";
6
7
  /**
7
- * Executes arbitrary FFmpeg commands and returns the results.
8
+ * One-shot FFmpeg execution. Extends {@link FfmpegProcess} directly, inheriting its spawn-on-construction and signal-driven teardown semantics and adding the small
9
+ * surface that the "feed bytes, read bytes, get exit status" pattern needs.
8
10
  *
9
- * This class extends `FfmpegProcess` to provide a simple interface for running FFmpeg with custom command-line arguments, capturing both standard output and standard
10
- * error, and returning process results in a structured format. Intended for plugin authors and advanced users who need to programmatically execute FFmpeg commands and
11
- * capture their results.
11
+ * The public `stdout` type is narrowed to `never` via `declare`. Callers read collected output through {@link FfmpegExec.stdoutBuffer} (the raw Buffer) or
12
+ * {@link FfmpegExec.result} (the bundled result with exit context). The narrowing is a type-level contract; pure-JS callers that reach past the types still see the
13
+ * underlying Readable, but a concurrent external reader would race with our internal collector - "do not do that" is the appropriate enforcement bar for a TypeScript
14
+ * library.
12
15
  *
13
16
  * @example
14
17
  *
15
18
  * ```ts
16
- * const exec = new FfmpegExec(options, ["-version"]);
17
- * const result = await exec.exec();
19
+ * // Canned input, one-shot.
20
+ * const exec = new FfmpegExec(options, { args, stdin: inputBuffer, signal });
21
+ * const { exitCode, stdout } = await exec.result();
22
+ * ```
23
+ *
24
+ * @example
25
+ *
26
+ * ```ts
27
+ * // Streaming input - write stdin progressively before awaiting the result.
28
+ * const exec = new FfmpegExec(options, { args, signal });
18
29
  *
19
- * if(result && result.exitCode === 0) {
30
+ * exec.stdin.write(chunk1);
31
+ * exec.stdin.write(chunk2);
32
+ * exec.stdin.end();
20
33
  *
21
- * console.log(result.stdout.toString());
22
- * }
34
+ * const { exitCode, stdout } = await exec.result();
23
35
  * ```
24
36
  *
25
37
  * @see FfmpegProcess
26
- * @see {@link https://ffmpeg.org/documentation.html | FFmpeg Documentation}
27
38
  *
28
39
  * @category FFmpeg
29
40
  */
30
41
  export class FfmpegExec extends FfmpegProcess {
31
- isLoggingErrors;
32
42
  /**
33
- * Creates a new instance of `FfmpegExec`.
34
- *
35
- * @param options - The options used to configure FFmpeg execution.
36
- * @param commandLineArgs - Optional. Command-line arguments to pass to the FFmpeg process.
37
- * @param logErrors - Optional. If `true`, errors will be logged; otherwise, they will be suppressed. Defaults to `true`.
43
+ * Promise that resolves with every byte the child wrote to stdout before its stdout pipe closed. The pipe closes for any reason - natural EOF after a clean exit,
44
+ * abort-driven kill, synthetic stream destroy - and the promise settles the same way: whatever the consumer absorbed before close, byte-for-byte.
38
45
  *
39
- * @example
46
+ * Resolves with `Buffer.alloc(0)` only when the underlying readable surfaces a stream error (the catch branch in `#collectStdout`); the abort-kill
47
+ * path does not normally produce a stream error, so an aborted run yields whatever bytes happened to arrive before the kill landed - which may be all of them, some
48
+ * of them, or none of them.
40
49
  *
41
- * ```ts
42
- * const exec = new FfmpegExec(options, ["-i", "input.mp4", "-f", "null", "-"]);
43
- * ```
50
+ * This promise is the data channel only. To discriminate "the child wrote nothing" from "the run was aborted before the child could write anything," consult
51
+ * {@link FfmpegExec.exited} (`exitCode` / `exitSignal`) and {@link FfmpegProcess.signal} (`signal.reason`). Those are the single source of truth for process
52
+ * disposition; an empty buffer carries no disposition meaning on its own.
44
53
  */
45
- constructor(options, commandLineArgs, logErrors = true) {
46
- // Initialize our parent.
47
- super(options, commandLineArgs);
48
- // We want to log errors when they occur.
49
- this.isLoggingErrors = logErrors;
50
- }
54
+ stdoutBuffer;
51
55
  /**
52
- * Runs the FFmpeg process and returns the result, including exit code, stdout, and stderr.
53
- *
54
- * If `stdinData` is provided, it will be written to the process's standard input before execution. Returns `null` if the process fails to start.
56
+ * Construct and spawn a new FFmpeg execution.
55
57
  *
56
- * @param stdinData - Optional. Data to write to FFmpeg's standard input.
58
+ * Spawning happens synchronously as part of construction. When `init.stdin` is supplied, the buffer is written to stdin and the stream is ended on the next
59
+ * microtask, giving synchronous post-construction caller code (e.g., attaching a drain listener) a chance to run before stdin I/O begins.
57
60
  *
58
- * @returns A promise that resolves to a `ProcessResult` object containing the exit code, stdout, and stderr, or `null` if the process could not be started.
59
- *
60
- * @example
61
- *
62
- * ```ts
63
- * const exec = new FfmpegExec(options, ["-i", "input.wav", "output.mp3"]);
64
- * const result = await exec.exec();
65
- *
66
- * if(result) {
67
- *
68
- * console.log("Exit code:", result.exitCode);
69
- * console.log("FFmpeg output:", result.stdout.toString());
70
- * }
71
- * ```
61
+ * @param options - Shared {@link FfmpegOptions} configuration (codec support, logger, debug flag, name).
62
+ * @param init - Optional init options. See {@link FfmpegExecInit}.
72
63
  */
73
- async exec(stdinData) {
74
- return new Promise((resolve) => {
75
- this.start();
76
- if (this.process === null) {
77
- this.log.error("Unable to execute command.");
78
- resolve(null);
79
- return;
80
- }
81
- // Write data to stdin and close
82
- if (stdinData) {
83
- this.process.stdin.end(stdinData);
84
- }
85
- const stderr = [];
86
- const stdout = [];
87
- // Read standard output and standard error into buffers.
88
- this.process.stderr.on("data", (chunk) => stderr.push(chunk));
89
- this.process.stdout.on("data", (chunk) => stdout.push(chunk));
90
- // We prepend this listener to ensure we can properly cleanup after ourselves.
91
- this.process.prependOnceListener("exit", () => {
92
- // Trigger our process cleanup activities.
93
- this.stop();
64
+ constructor(options, init = {}) {
65
+ super(options, init);
66
+ // Drain stdout into an in-memory buffer via Node's `node:stream/consumers` helper. The consumer attaches the necessary listeners and respects internal buffering,
67
+ // so chunks that landed in the paused stream before consumption began are still delivered. The collector is a pure transducer over the readable - it does not
68
+ // observe the lifetime signal, and it deliberately knows nothing about why the readable might close. The disposition of the run lives in `exited` and
69
+ // `signal.reason`; conflating it into the byte content would create a sentinel callers cannot rely on (Node's stream layer cannot deterministically deliver
70
+ // "all-or-nothing" on a kill-driven close). The catch in `#collectStdout` exists only to honor the never-rejects shape on `stdoutBuffer` when the readable
71
+ // surfaces a genuine stream error.
72
+ this.stdoutBuffer = this.#collectStdout();
73
+ // Canned stdin: write and end on the next microtask so synchronous caller code that runs between construction and the first await (e.g., attaching `"drain"` or
74
+ // `"error"` listeners on the inherited `stdin` writable, inspecting `proc.signal`, wiring diagnostic hooks) executes before stdin I/O starts. We guard against a
75
+ // pre-aborted composed signal so we do not write to a stream that the kill path has already destroyed - the write would surface an EPIPE we would then have to
76
+ // swallow. The base class's own stdin error listener already swallows EPIPE generally, so this guard is belt-and-braces, not strictly required for correctness.
77
+ if (init.stdin !== undefined) {
78
+ const stdinBuffer = init.stdin;
79
+ queueMicrotask(() => {
80
+ if (this.aborted) {
81
+ return;
82
+ }
83
+ this._stdin.end(stdinBuffer);
94
84
  });
95
- // Return when process is done.
96
- this.process.once("exit", (exitCode) => {
97
- // Return the output and results.
98
- resolve({
99
- exitCode,
100
- stderr: Buffer.concat(stderr),
101
- stdout: Buffer.concat(stdout)
102
- });
103
- });
104
- });
85
+ }
105
86
  }
106
87
  /**
107
- * Logs errors encountered during FFmpeg execution.
88
+ * Await the process to completion and return the bundled result.
108
89
  *
109
- * If error logging is disabled, this method will do nothing. Otherwise, it calls the parent implementation for standard logging behavior.
90
+ * Resolves once both the stdout collector and the base class's `exited` promise settle. Rejects with the same reason `exited` would reject with (today, only when
91
+ * the child never spawned - e.g., ENOENT). On any normal exit, including non-zero exit codes, this method resolves; callers discriminate outcomes by inspecting
92
+ * `exitCode` and `exitSignal` in the result, or the derived `hasError` getter on the instance.
110
93
  *
111
- * @param exitCode - The exit code returned by the FFmpeg process.
112
- * @param signal - The signal used to terminate the process, if any.
94
+ * @returns A promise resolving to an {@link ExecResult} bundling stdout, exit code, exit signal, and the accumulated stderr log.
113
95
  */
114
- logFfmpegError(exitCode, signal) {
115
- // If we're ignoring errors, we're done.
116
- if (!this.isLoggingErrors) {
117
- return;
96
+ async result() {
97
+ const [stdout, exit] = await Promise.all([this.stdoutBuffer, this.exited]);
98
+ return { exitCode: exit.exitCode, exitSignal: exit.exitSignal, stderrLog: this.stderrLog, stdout };
99
+ }
100
+ // Buffer-collector wrapper around `node:stream/consumers` `buffer()`. The happy path resolves with whatever bytes the consumer absorbed before the readable closed,
101
+ // for any close cause - clean EOF, kill-driven pipe close after abort, anything else. The catch is reserved for the rare path where the readable surfaces a stream
102
+ // error (e.g., a synthetic `readable.destroy(err)` injected by a test, a hardware-level pipe fault); we resolve with `Buffer.alloc(0)` there only to preserve the
103
+ // never-rejects shape on `stdoutBuffer`. Private method rather than an inline `await buffer(...)` because keeping the try/catch in one place preserves that
104
+ // shape across every caller path.
105
+ async #collectStdout() {
106
+ try {
107
+ return await buffer(this._stdout);
108
+ }
109
+ catch {
110
+ return Buffer.alloc(0);
118
111
  }
119
- // Otherwise, revert to our default logging in our parent.
120
- super.logFfmpegError(exitCode, signal);
121
112
  }
122
113
  }
123
114
  //# sourceMappingURL=exec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/ffmpeg/exec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAmB7C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,UAAW,SAAQ,aAAa;IAEnC,eAAe,CAAU;IAEjC;;;;;;;;;;;;OAYG;IACH,YAAY,OAAsB,EAAE,eAA0B,EAAE,SAAS,GAAG,IAAI;QAE9E,yBAAyB;QACzB,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAEhC,yCAAyC;QACzC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACI,KAAK,CAAC,IAAI,CAAC,SAAkB;QAElC,OAAO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