Skip to content

best way to save what you love

stream/types: move closeResponse to shared

wukkof632c7dfb3cb
diff --git a/src/modules/stream/shared.js b/src/modules/stream/shared.js
index 2f898c52..8555f8ba 100644
--- a/src/modules/stream/shared.js
+++ b/src/modules/stream/shared.js
@@ -16,6 +16,11 @@ const serviceHeaders = {
}
}
+export function closeResponse(res) {
+ if (!res.headersSent) res.sendStatus(500);
+ return res.destroy();
+}
+
export function getHeaders(service) {
return { ...defaultHeaders, ...serviceHeaders[service] }
}
\ No newline at end of file
diff --git a/src/modules/stream/types.js b/src/modules/stream/types.js
index 87c9f600..a1db0c60 100644
--- a/src/modules/stream/types.js
+++ b/src/modules/stream/types.js
@@ -6,7 +6,7 @@ import { create as contentDisposition } from "content-disposition-header";
import { metadataManager } from "../sub/utils.js";
import { destroyInternalStream } from "./manage.js";
import { env, ffmpegArgs } from "../config.js";
-import { getHeaders } from "./shared.js";
+import { getHeaders, closeResponse } from "./shared.js";
function toRawHeaders(headers) {
return Object.entries(headers)
@@ -18,11 +18,6 @@ function closeRequest(controller) {
try { controller.abort() } catch {}
}
-function closeResponse(res) {
- if (!res.headersSent) res.sendStatus(500);
- return res.destroy();
-}
-
function killProcess(p) {
// ask the process to terminate itself gracefully
p?.kill('SIGTERM');