mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
perf(turntable): stream file via Bun.file and increase upload timeout
This commit is contained in:
@@ -260,7 +260,6 @@ export class TurntableService {
|
|||||||
throw new Error('Turntable renderer URL is not configured.')
|
throw new Error('Turntable renderer URL is not configured.')
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileBytes = fs.readFileSync(filePath)
|
|
||||||
const headers: Record<string, string> = {
|
const headers: Record<string, string> = {
|
||||||
'content-type': 'application/octet-stream',
|
'content-type': 'application/octet-stream',
|
||||||
'x-filename': encodeURIComponent(filename),
|
'x-filename': encodeURIComponent(filename),
|
||||||
@@ -273,8 +272,8 @@ export class TurntableService {
|
|||||||
const response = await fetch(`${config.url}/v1/files`, {
|
const response = await fetch(`${config.url}/v1/files`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers,
|
headers,
|
||||||
body: fileBytes,
|
body: Bun.file(filePath),
|
||||||
signal: AbortSignal.timeout(120000),
|
signal: AbortSignal.timeout(300000),
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|||||||
Reference in New Issue
Block a user