mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-12 20:25:06 +01:00
passthrough content-type; content-length
This commit is contained in:
parent
814bfa404a
commit
d54655c6b0
1 changed files with 5 additions and 1 deletions
|
@ -15,9 +15,13 @@ export async function streamDefault(streamInfo, res) {
|
|||
let regFilename = !streamInfo.mute ? streamInfo.filename : `${streamInfo.filename.split('.')[0]}_mute.${format}`;
|
||||
res.setHeader('Content-disposition', `attachment; filename="${streamInfo.isAudioOnly ? `${streamInfo.filename}.${streamInfo.audioFormat}` : regFilename}"`);
|
||||
|
||||
const { body: stream } = await request(streamInfo.urls, {
|
||||
const { body: stream, headers } = await request(streamInfo.urls, {
|
||||
headers: { 'user-agent': genericUserAgent }
|
||||
});
|
||||
|
||||
res.setHeader('content-type', headers['content-type']);
|
||||
res.setHeader('content-length', headers['content-length']);
|
||||
|
||||
stream.pipe(res).on('error', () => fail(res));
|
||||
stream.on('error', () => fail(res));
|
||||
stream.on('aborted', () => fail(res));
|
||||
|
|
Loading…
Reference in a new issue