fix: refactoring, adding express api.

This commit is contained in:
charlesgauthereau
2026-01-31 22:15:01 +01:00
parent 7c5d57ddc1
commit cc87cf68b5
33 changed files with 1028 additions and 142 deletions
+3 -4
View File
@@ -35,10 +35,9 @@ export async function GET(
const result = await dispatchStorage(input, undefined, storageId);
if (!result.success) {
return NextResponse.json({error: "Enable to get file from privided storage channel, an error occurred !"})
return NextResponse.json({error: "Enable to get file from provided storage channel, an error occurred !"})
}
const fileName = path.basename(pathFromUrl);
const crypto = require('crypto');
@@ -58,14 +57,14 @@ export async function GET(
);
}
if (!result.file || !Buffer.isBuffer(result.file)) {
if (!result.file || !(result.file instanceof Readable)) {
return NextResponse.json(
{error: "Invalid file payload"},
{status: 500}
);
}
const fileStream = Readable.from(result.file);
const fileStream = Readable.from(result.file as Readable);
const stream = new ReadableStream({
start(controller) {