diff --git a/README.md b/README.md index 2dc1648..e54d655 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ export function UploadForm() { const handleFormAction = (formData: FormData) => { const file = formData.get("file") as File; if (!file) return; + const uploader = new ChunkUploader({ file, onChunkUpload: chunkUploadAction, @@ -63,6 +64,7 @@ export function UploadForm() { console.log("Upload complete"); }, }); + uploader.start(); }; @@ -112,6 +114,7 @@ export async function chunkUploadAction( start: offset, } ); + return new Promise((resolve, reject) => { writeable.on("finish", () => resolve()); writeable.on("error", reject); diff --git a/package-lock.json b/package-lock.json index c9c6091..0348a40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nextjs-chunk-upload-action", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nextjs-chunk-upload-action", - "version": "1.1.0", + "version": "1.2.0", "license": "MIT", "devDependencies": { "@types/node": "^20.11.21", @@ -1790,4 +1790,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 897654d..68d301d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nextjs-chunk-upload-action", - "version": "1.1.0", + "version": "1.2.0", "description": "Uploading large files with chunking using server action in Next.js", "main": "dist/index.js", "scripts": {