Skip to content

Commit

Permalink
fix(bigFile): connecting chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Jul 26, 2024
1 parent 2bf1828 commit 6caa768
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/simple-form/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const onRequest = sequence(astroForms({
forms: {
bigFilesUpload: {
bigFileServerOptions: {
maxUploadSize: 1024 * 1024 // 1MB
maxUploadSize: 1024 * 1024 * 1024, // 1GB
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createReadStream } from "fs";
import { CreateReadStreamOptions, stat, copyFile } from "fs/promises";
import { type CreateReadStreamOptions, stat, copyFile } from "fs/promises";

export class BigFile {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ export async function loadUploadFiles(astro: AstroGlobal, options: Partial<LoadU
}

const outputStream = oldFs.createWriteStream(uploadFilePath, { flags: 'a' });
for (const file of files) {
const fileFullPath = path.join(uploadDir, file);
for (let i = 1; i <= total; i++) {
const fileFullPath = path.join(uploadDir, `${i}-${total}`);
const inputStream = oldFs.createReadStream(fileFullPath);
await new Promise((resolve, reject) => {
inputStream.on("data", (chunk) => {
Expand Down

0 comments on commit 6caa768

Please sign in to comment.