mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 20:34:28 +00:00
fix(agent): restrict pageCount and duration recommendations to matching media types (#397)
This commit is contained in:
@@ -232,9 +232,13 @@ export class S3StorageService implements S3Service {
|
||||
return
|
||||
}
|
||||
|
||||
const writeStream = fs.createWriteStream(filePath)
|
||||
try {
|
||||
await pipeline(res.Body as unknown as NodeJS.ReadableStream, fs.createWriteStream(filePath))
|
||||
await pipeline(res.Body as unknown as NodeJS.ReadableStream, writeStream)
|
||||
} catch (err) {
|
||||
if (!writeStream.closed) {
|
||||
await new Promise((resolve) => writeStream.once('close', resolve))
|
||||
}
|
||||
await fs.promises.unlink(filePath).catch(() => {})
|
||||
throw err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user