{"_id":"@amunozsesma/file-uploader","_rev":"6-447ca9a39b6847f7c17779e9234a6dad","name":"@amunozsesma/file-uploader","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@amunozsesma/file-uploader","version":"1.0.0","keywords":["nextjs","react","file-upload","s3","aws"],"author":{"name":"Your Name"},"license":"MIT","_id":"@amunozsesma/file-uploader@1.0.0","maintainers":[{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"}],"homepage":"https://github.com/your-username/file-uploader#readme","bugs":{"url":"https://github.com/your-username/file-uploader/issues"},"dist":{"shasum":"204b8dc6fdff9dc6a66191d9c10ceac835b95dc4","tarball":"https://registry.npmjs.org/@amunozsesma/file-uploader/-/file-uploader-1.0.0.tgz","fileCount":6,"integrity":"sha512-6c5+wqyV8cDlWwk8q//ODz7f4PR99ndNmUzhldM38Fh/K8XGh7BLc0S4lYjU/hU8gnd6591upSKoxhZNQl4i2g==","signatures":[{"sig":"MEUCIQDXrOG4o5x2z5pMbpq/szSp4cn2ZvYAsLPPKUnKeYCjmwIgErWQRXxAsuXQvtuch7ZLvZttRY384zxXQ50W8KJXIkg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":74677},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"08de8f61454651ce1d4fea5a69f4c4682a14de23","private":false,"scripts":{"dev":"next dev","lint":"next lint","build":"next build","start":"next start","build:package":"tsup index.ts --format cjs,esm --dts --external react --external next --external react-dom --external @aws-sdk/* --external uuid --no-config","prepublishOnly":"npm run build:package"},"_npmUser":{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"},"repository":{"url":"git+https://github.com/your-username/file-uploader.git","type":"git"},"_npmVersion":"10.9.2","description":"A Next.js file uploader component with S3 integration","directories":{},"_nodeVersion":"22.14.0","dependencies":{"next":"14.1.0","uuid":"^9.0.0","react":"^18","react-dom":"^18","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-presigned-post":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","eslint":"^8","postcss":"^8","@swc/core":"^1.11.18","typescript":"^5","@types/node":"^20","@types/uuid":"^9.0.0","tailwindcss":"^3.3.0","@types/react":"^18","autoprefixer":"^10.0.1","@types/react-dom":"^18","eslint-config-next":"14.1.0"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/file-uploader_1.0.0_1744147065016_0.7304748378249215","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@amunozsesma/file-uploader","version":"1.0.1","keywords":["nextjs","react","file-upload","s3","aws"],"author":{"name":"Your Name"},"license":"MIT","_id":"@amunozsesma/file-uploader@1.0.1","maintainers":[{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"}],"homepage":"https://github.com/your-username/file-uploader#readme","bugs":{"url":"https://github.com/your-username/file-uploader/issues"},"dist":{"shasum":"dde353dadfc51c64c8ff75a394785dbc09e37cbb","tarball":"https://registry.npmjs.org/@amunozsesma/file-uploader/-/file-uploader-1.0.1.tgz","fileCount":6,"integrity":"sha512-9DNsqZYwepQdpFrDomckhQEIA/5tS29pawtWyk0HJYKF4xNTuH+930r7w0uMZsI1lHfpCDdXK086LlrorDjAaA==","signatures":[{"sig":"MEQCIDCYeMH6NGzCDwtyQVp0hm5rpWfMdVb2TI+F/+AKhfPMAiBW2vrh3ZKK34LosPARlZi7/4/3ZreXthBa/ElUk0LzAw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73401},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"0ef960ba8a9832d56ea918244a156dafcc24ad37","private":false,"scripts":{"dev":"next dev","lint":"next lint","build":"next build","start":"next start","build:package":"tsup index.ts --format cjs,esm --dts --external react --external next --external react-dom --external @aws-sdk/* --external uuid --no-config","prepublishOnly":"npm run build:package"},"_npmUser":{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"},"repository":{"url":"git+https://github.com/your-username/file-uploader.git","type":"git"},"_npmVersion":"10.9.2","description":"A Next.js file uploader component with S3 integration","directories":{},"_nodeVersion":"22.14.0","dependencies":{"next":"14.1.0","uuid":"^9.0.0","react":"^18","react-dom":"^18","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-presigned-post":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","eslint":"^8","postcss":"^8","@swc/core":"^1.11.18","typescript":"^5","@types/node":"^20","@types/uuid":"^9.0.0","tailwindcss":"^3.3.0","@types/react":"^18","autoprefixer":"^10.0.1","@types/react-dom":"^18","eslint-config-next":"14.1.0"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/file-uploader_1.0.1_1744148561654_0.31197020936475606","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@amunozsesma/file-uploader","version":"1.0.2","keywords":["nextjs","react","file-upload","s3","aws"],"author":{"name":"Your Name"},"license":"MIT","_id":"@amunozsesma/file-uploader@1.0.2","maintainers":[{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"}],"homepage":"https://github.com/your-username/file-uploader#readme","bugs":{"url":"https://github.com/your-username/file-uploader/issues"},"dist":{"shasum":"bf9124b53914e1a096db788df4b54e48e60869ba","tarball":"https://registry.npmjs.org/@amunozsesma/file-uploader/-/file-uploader-1.0.2.tgz","fileCount":6,"integrity":"sha512-WjFslfv1MkRLzIlomvP6hlSjzbTt6T34f+Fe4iN753iODB5YJJB6bZRJWJVM0yr1VW4xAkmfZE2lnhqjm58mQw==","signatures":[{"sig":"MEYCIQCzVRK9G3ZInTSJecUydWQZPWAApcdmGyJL1gHhNh507gIhALVrqW2FvXLyIS5Iv6hEsjxPCNZI7URKQZUzPjBGQmYL","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":81293},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"1dfc36dbb414406cdcfdb28edef767063ddd4c0e","private":false,"scripts":{"dev":"next dev","lint":"next lint","build":"next build","start":"next start","build:package":"tsup index.ts --format cjs,esm --dts --external react --external next --external react-dom --external @aws-sdk/* --external uuid --no-config","prepublishOnly":"npm run build:package"},"_npmUser":{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"},"repository":{"url":"git+https://github.com/your-username/file-uploader.git","type":"git"},"_npmVersion":"10.9.2","description":"A Next.js file uploader component with S3 integration","directories":{},"_nodeVersion":"22.14.0","dependencies":{"next":"14.1.0","uuid":"^9.0.0","react":"^18","react-dom":"^18","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-presigned-post":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","eslint":"^8","postcss":"^8","@swc/core":"^1.11.18","typescript":"^5","@types/node":"^20","@types/uuid":"^9.0.0","tailwindcss":"^3.3.0","@types/react":"^18","autoprefixer":"^10.0.1","@types/react-dom":"^18","eslint-config-next":"14.1.0"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/file-uploader_1.0.2_1744151100405_0.3343621085619177","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@amunozsesma/file-uploader","version":"1.0.3","keywords":["nextjs","react","file-upload","s3","aws"],"author":{"name":"Your Name"},"license":"MIT","_id":"@amunozsesma/file-uploader@1.0.3","maintainers":[{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"}],"homepage":"https://github.com/your-username/file-uploader#readme","bugs":{"url":"https://github.com/your-username/file-uploader/issues"},"dist":{"shasum":"d6d3fbd22d0d9fb59bc258e6adface2160b395f0","tarball":"https://registry.npmjs.org/@amunozsesma/file-uploader/-/file-uploader-1.0.3.tgz","fileCount":6,"integrity":"sha512-v/J797W3QudwEan2oxAZgXCUdk0SN8BIUs1GtNF80Md8A9d8hdpIY3zpMzcqWXBuZOgs99B7gR4mu2AAoJ5Wpw==","signatures":[{"sig":"MEUCIAOlT7Uxdh9SmI7SxZ6aLgxA0gFu8+qw3HqZryAlXwDvAiEAvcbQlYJSofbzINuZ3JYGAwycAT6tSk//GHh/FQE5Ho0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":79017},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"f129e64d8d7bea022d0207fa6eb762dfc10a30c3","private":false,"scripts":{"dev":"next dev","lint":"next lint","build":"next build","start":"next start","build:package":"tsup index.ts --format cjs,esm --dts --external react --external next --external react-dom --external @aws-sdk/* --external uuid --no-config","prepublishOnly":"npm run build:package"},"_npmUser":{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"},"repository":{"url":"git+https://github.com/your-username/file-uploader.git","type":"git"},"_npmVersion":"10.9.2","description":"A Next.js file uploader component with S3 integration","directories":{},"_nodeVersion":"22.14.0","dependencies":{"next":"14.1.0","uuid":"^9.0.0","react":"^18","react-dom":"^18","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-presigned-post":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","eslint":"^8","postcss":"^8","@swc/core":"^1.11.18","typescript":"^5","@types/node":"^20","@types/uuid":"^9.0.0","tailwindcss":"^3.3.0","@types/react":"^18","autoprefixer":"^10.0.1","@types/react-dom":"^18","eslint-config-next":"14.1.0"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/file-uploader_1.0.3_1744152444337_0.9897843260059589","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@amunozsesma/file-uploader","version":"1.0.4","keywords":["nextjs","react","file-upload","s3","aws"],"author":{"name":"Your Name"},"license":"MIT","_id":"@amunozsesma/file-uploader@1.0.4","maintainers":[{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"}],"homepage":"https://github.com/your-username/file-uploader#readme","bugs":{"url":"https://github.com/your-username/file-uploader/issues"},"dist":{"shasum":"37c146692d6003cf3ec6bf9e121f05d11c192961","tarball":"https://registry.npmjs.org/@amunozsesma/file-uploader/-/file-uploader-1.0.4.tgz","fileCount":6,"integrity":"sha512-sU936JmcG7M1NWh3n4D1QBaGWqvYqV2D2KzTZZ7HQBv1rEyPPbdB/PreZYpzbANdd/35hDevHRQaGucjdCk0zA==","signatures":[{"sig":"MEUCIBtE+BVx3HFBPyjua363nnoqGtM1ysmFRd3tk8eoX9bMAiEAj2lekE0nT9lbnegEuHBCOJKJACUm4H3t7epBqRx6Zs0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":79694},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"dd740c9d8576abf198b02f6b470e23be4d225d98","private":false,"scripts":{"dev":"next dev","lint":"next lint","build":"next build","start":"next start","build:package":"tsup index.ts --format cjs,esm --dts --external react --external next --external react-dom --external @aws-sdk/* --external uuid --no-config","prepublishOnly":"npm run build:package"},"_npmUser":{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"},"repository":{"url":"git+https://github.com/your-username/file-uploader.git","type":"git"},"_npmVersion":"10.9.2","description":"A Next.js file uploader component with S3 integration","directories":{},"_nodeVersion":"22.14.0","dependencies":{"next":"14.1.0","uuid":"^9.0.0","react":"^18","react-dom":"^18","@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-presigned-post":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","eslint":"^8","postcss":"^8","@swc/core":"^1.11.18","typescript":"^5","@types/node":"^20","@types/uuid":"^9.0.0","tailwindcss":"^3.3.0","@types/react":"^18","autoprefixer":"^10.0.1","@types/react-dom":"^18","eslint-config-next":"14.1.0"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/file-uploader_1.0.4_1744153025390_0.9509541485145272","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@amunozsesma/file-uploader","version":"1.0.5","private":false,"description":"A Next.js file uploader component with S3 integration","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","scripts":{"dev":"next dev","build":"next build","start":"next start","lint":"next lint","prepublishOnly":"npm run build:package","build:package":"tsup index.ts --format cjs,esm --dts --external react --external next --external react-dom --external @aws-sdk/* --external uuid --no-config"},"dependencies":{"@aws-sdk/client-s3":"^3.0.0","@aws-sdk/s3-request-presigner":"^3.0.0","@aws-sdk/s3-presigned-post":"^3.0.0","next":"14.1.0","react":"^18","react-dom":"^18","uuid":"^9.0.0"},"devDependencies":{"@swc/core":"^1.11.18","@types/node":"^20","@types/react":"^18","@types/react-dom":"^18","@types/uuid":"^9.0.0","autoprefixer":"^10.0.1","eslint":"^8","eslint-config-next":"14.1.0","postcss":"^8","tailwindcss":"^3.3.0","typescript":"^5","tsup":"^8.0.1"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0","react-dom":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/your-username/file-uploader.git"},"keywords":["nextjs","react","file-upload","s3","aws"],"author":{"name":"Your Name"},"license":"MIT","_id":"@amunozsesma/file-uploader@1.0.5","gitHead":"5b239450119f9d9b7e77c214a6ce93b5556841a8","bugs":{"url":"https://github.com/your-username/file-uploader/issues"},"homepage":"https://github.com/your-username/file-uploader#readme","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-aw8QM3QkT/b9GR5RCYCcegbZHldMjUKPPDsQ6vq0JX7L98RVk9usNzmP9+sS3XbRjSW75eERC2LP7f4nV+H2Xg==","shasum":"c567be8b37db7fa5d415db889e7b8a330e04086e","tarball":"https://registry.npmjs.org/@amunozsesma/file-uploader/-/file-uploader-1.0.5.tgz","fileCount":6,"unpackedSize":79838,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICwwsnaCETHm4/LqiayuNnwR4VSe8umVLn6xMjT0zlXDAiEAqhT2JzpX1l2S+5hICGj/c3l9zlgZDo/oZtC0p9uDWOc="}]},"_npmUser":{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"},"directories":{},"maintainers":[{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/file-uploader_1.0.5_1744153270884_0.14566441979677247"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-08T21:17:44.900Z","modified":"2025-04-08T23:01:11.315Z","1.0.0":"2025-04-08T21:17:45.246Z","1.0.1":"2025-04-08T21:42:41.864Z","1.0.2":"2025-04-08T22:25:00.620Z","1.0.3":"2025-04-08T22:47:24.582Z","1.0.4":"2025-04-08T22:57:05.613Z","1.0.5":"2025-04-08T23:01:11.140Z"},"bugs":{"url":"https://github.com/your-username/file-uploader/issues"},"author":{"name":"Your Name"},"license":"MIT","homepage":"https://github.com/your-username/file-uploader#readme","keywords":["nextjs","react","file-upload","s3","aws"],"repository":{"type":"git","url":"git+https://github.com/your-username/file-uploader.git"},"description":"A Next.js file uploader component with S3 integration","maintainers":[{"name":"amunozsesma","email":"a.munozsesma@googlemail.com"}],"readme":"# File Uploader\n\nA reusable file uploader hook with AWS S3 integration for Next.js applications.\n\n## Features\n\n- 📁 Generic file uploader hook with progress tracking\n- 🔄 S3 pre-signed URL upload flow\n- 📥 Download API for retrieving files\n- ⚙️ Fully configurable routes and hooks\n- 🔌 Easy to integrate in any Next.js project\n- 📦 TypeScript support with exported types\n\n## Installation\n\nYou can install the package directly from npm:\n\n```bash\n# Using npm\nnpm install file-uploader\n\n# Using yarn\nyarn add file-uploader\n\n# Using pnpm\npnpm add file-uploader\n```\n\nOr you can install from your GitLab repository:\n\n```bash\n# Using npm\nnpm install git+https://gitlab.com/your-username/file-uploader.git\n\n# Using yarn\nyarn add git+https://gitlab.com/your-username/file-uploader.git\n\n# Using pnpm\npnpm add git+https://gitlab.com/your-username/file-uploader.git\n```\n\n## Environment Variables\n\nCreate a `.env` file in your project root with the following variables:\n\n```\n# AWS S3 Configuration\nAWS_REGION=us-east-1\nAWS_ACCESS_KEY_ID=your_access_key_id\nAWS_SECRET_ACCESS_KEY=your_secret_access_key\nAWS_S3_BUCKET=your_bucket_name\n\n# API Configuration\nNEXT_PUBLIC_API_URL=http://localhost:3000\n```\n\n## Usage\n\n### useFileUploader Hook\n\n```tsx\nimport { useState } from 'react';\nimport { useFileUploader } from 'file-uploader';\n\nexport default function UploadPage() {\n  const [file, setFile] = useState<File | null>(null);\n  const [uploadProgress, setUploadProgress] = useState(0);\n  const [uploadedKey, setUploadedKey] = useState<string | null>(null);\n  const [error, setError] = useState<string | null>(null);\n  \n  const { isUploading, uploadFile, reset } = useFileUploader({\n    file,\n    allowedFileTypes: ['image/jpeg', 'image/png', 'application/pdf'],\n    maxFileSize: 10 * 1024 * 1024, // 10MB\n    onUploadComplete: (key) => {\n      console.log('Uploaded:', key);\n      setUploadedKey(key);\n    },\n    onUploadError: (error) => {\n      console.error('Error:', error);\n      setError(error.message);\n    },\n    onUploadProgress: (progress) => {\n      console.log('Progress:', progress);\n      setUploadProgress(progress);\n    },\n    config: {\n      apiBaseUrl: 'https://your-api.com',\n      endpoints: {\n        uploadUrl: '/api/custom/upload'\n      }\n    }\n  });\n  \n  const handleFileChange = (e) => {\n    const selectedFile = e.target.files?.[0] || null;\n    if (selectedFile) {\n      setFile(selectedFile);\n      reset(); // Reset the upload state\n      \n      // Optionally start upload immediately\n      uploadFile(selectedFile).catch((err) => {\n        // Error is handled by onUploadError\n      });\n    }\n  };\n  \n  return (\n    <div>\n      <input \n        type=\"file\" \n        onChange={handleFileChange} \n        disabled={isUploading}\n      />\n      \n      {uploadProgress > 0 && (\n        <div>Upload progress: {uploadProgress}%</div>\n      )}\n      \n      {error && (\n        <div>Error: {error}</div>\n      )}\n      \n      {uploadedKey && (\n        <div>File uploaded successfully! Key: {uploadedKey}</div>\n      )}\n    </div>\n  );\n}\n\n// Or allow any file type with the wildcard option\nfunction AnyFileUploader() {\n  const [file, setFile] = useState<File | null>(null);\n  \n  const { isUploading, uploadFile } = useFileUploader({\n    file,\n    allowedFileTypes: '*', // Accept any file type\n    maxFileSize: 10 * 1024 * 1024,\n    onUploadComplete: (key) => console.log('Uploaded:', key)\n  });\n  \n  return (\n    <div>\n      <input \n        type=\"file\" \n        onChange={(e) => {\n          const selectedFile = e.target.files?.[0] || null;\n          if (selectedFile) {\n            setFile(selectedFile);\n            uploadFile(selectedFile);\n          }\n        }} \n        disabled={isUploading}\n      />\n    </div>\n  );\n}\n```\n\n### API Routes\n\n#### Upload Route\n\nIn your Next.js API route:\n\n```ts\n// app/api/upload/route.ts\nimport { createUploadHandler } from 'file-uploader';\n\n// Custom configuration with specific file types\nexport const POST = createUploadHandler({\n  allowedFileTypes: ['image/jpeg', 'image/png', 'application/pdf'],\n  maxFileSize: 10 * 1024 * 1024 // 10MB\n});\n\n// Or allow any file type\nexport const POST = createUploadHandler({\n  allowedFileTypes: '*',\n  maxFileSize: 10 * 1024 * 1024 // 10MB\n});\n```\n\n#### Download Route\n\nIn your Next.js API route:\n\n```ts\n// app/api/download/route.ts\nimport { createDownloadHandler } from 'file-uploader';\n\n// With optional hook\nexport const POST = createDownloadHandler({\n  onDownload: async (s3Key) => {\n    // Log download or update analytics\n    console.log(`File downloaded: ${s3Key}`);\n  }\n});\n```\n## Configuration\n\n### useFileUploader Props\n\n| Prop | Type | Description |\n|------|------|-------------|\n| `file` | `File \\| null` | The file to upload (pass null initially) |\n| `allowedFileTypes` | `string[]` or `'*'` | List of allowed MIME types or `'*'` for any type (required) |\n| `maxFileSize` | `number` | Maximum file size in bytes (required) |\n| `onUploadComplete` | `(key: string) => void` | Callback when upload completes |\n| `onUploadError` | `(error: Error) => void` | Callback when upload fails |\n| `onUploadProgress` | `(progress: number) => void` | Callback for upload progress |\n| `config` | `FileUploaderConfig` | Additional configuration options |\n\n### useFileUploader Return Value\n\n```typescript\ninterface UseFileUploaderResult {\n  isUploading: boolean;       // Whether a file is currently being uploaded\n  uploadFile: (file: File) => Promise<void>;  // Function to manually trigger upload\n  reset: () => void;          // Function to reset the upload state\n}\n```\n\n### FileUploaderConfig\n\n```typescript\ninterface FileUploaderConfig {\n  apiBaseUrl?: string;\n  endpoints?: {\n    uploadUrl?: string;\n  };\n}\n```\n\n## Development\n\n### Setup\n\n1. **Prerequisites**\n   - Node.js (v18 or later)\n   - npm or yarn\n   - AWS Account\n\n2. **Project Setup**\n   ```bash\n   # Clone the repository\n   git clone https://github.com/your-username/file-uploader.git\n   cd file-uploader\n\n   # Install dependencies\n   npm install\n   ```\n\n3. **AWS Configuration**\n   1. Create an S3 Bucket:\n      - Go to S3 in AWS Console\n      - Click \"Create bucket\"\n      - Enter a unique bucket name (e.g., \"my-app-files\")\n      - Choose your region (use \"us-east-1\" as in .env)\n      - Enable versioning and default encryption\n   \n   2. Create IAM User:\n      - Go to IAM in AWS Console\n      - Create a new user with programmatic access\n      - Attach a policy with S3 permissions:\n      ```json\n      {\n          \"Version\": \"2012-10-17\",\n          \"Statement\": [\n              {\n                  \"Effect\": \"Allow\",\n                  \"Action\": [\n                      \"s3:PutObject\",\n                      \"s3:GetObject\",\n                      \"s3:DeleteObject\",\n                      \"s3:ListBucket\"\n                  ],\n                  \"Resource\": [\n                      \"arn:aws:s3:::your-bucket-name/*\",\n                      \"arn:aws:s3:::your-bucket-name\"\n                  ]\n              }\n          ]\n      }\n      ```\n      - Save the Access Key ID and Secret Access Key\n   \n   3. Configure CORS:\n      - Go to your bucket in S3 Console\n      - Click \"Permissions\" → \"CORS\"\n      - Add this configuration:\n      ```json\n      [\n          {\n              \"AllowedHeaders\": [\"*\"],\n              \"AllowedMethods\": [\"PUT\", \"POST\", \"DELETE\", \"GET\"],\n              \"AllowedOrigins\": [\n                  \"http://localhost:3000\",\n                  \"https://your-production-domain.com\"\n              ],\n              \"ExposeHeaders\": [\"ETag\"]\n          }\n      ]\n      ```\n\n4. **Environment Setup**\n   Create a `.env` file in your project root:\n   ```env\n   # AWS S3 Configuration\n   AWS_REGION=us-east-1\n   AWS_ACCESS_KEY_ID=your_access_key_id\n   AWS_SECRET_ACCESS_KEY=your_secret_access_key\n   AWS_S3_BUCKET=your_bucket_name\n\n   # API Configuration\n   NEXT_PUBLIC_API_URL=http://localhost:3000\n   ```\n\n5. **Start Development Server**\n   ```bash\n   npm run dev\n   ```\n\n### Common Errors\n\n1. **Missing Environment Variables**\n   - Ensure all required environment variables are set in your `.env` file\n   - Check that AWS credentials are correct and have proper permissions\n\n2. **CORS Issues**\n   - Verify your S3 bucket CORS configuration\n   - Ensure your domain is listed in the allowed origins\n\n3. **File Size Limits**\n   - Check that your file size is within the configured limits\n   - Verify S3 bucket policies allow the file size\n\n4. **File Type Restrictions**\n   - Ensure the file type is included in `allowedFileTypes`\n   - Use `'*'` to allow any file type\n\n## License\n\nMIT","readmeFilename":"README.md"}