Fix http api
This commit is contained in:
parent
51e22f6d48
commit
151add9854
1 changed files with 6 additions and 3 deletions
9
index.ts
9
index.ts
|
@ -24,12 +24,15 @@ Bun.serve({
|
|||
|
||||
const { manifestMimeType, manifest } = await utils.fetchTrack(trackId)
|
||||
|
||||
const audio = await utils.tagFlac(trackId, await utils.downloadFlac(manifestMimeType, manifest))
|
||||
const audio = await utils.downloadFlac(manifestMimeType, manifest);
|
||||
if (audio.mimeType === "audio/flac") {
|
||||
audio.buffer = Buffer.from(await utils.tagFlac(trackId, audio.buffer))
|
||||
}
|
||||
//await Bun.write(`downloaded/${trackId}.flac`, audio)
|
||||
|
||||
return new Response(audio, {
|
||||
return new Response(audio.buffer, {
|
||||
headers: {
|
||||
"Content-Type": "audio/flac",
|
||||
"Content-Type": audio.mimeType,
|
||||
//"Content-Disposition": `attachment; filename="${trackId}.flac"`,
|
||||
"Cache-Control": "public, max-age=31536000",
|
||||
"ETag": trackId.toString(),
|
||||
|
|
Loading…
Add table
Reference in a new issue