stream/types: move closeResponse to shared
This commit is contained in:
parent
b1ed1f5199
commit
f632c7dfb3
2 changed files with 6 additions and 6 deletions
|
@ -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] }
|
||||
}
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue