{"_id":"@chao_yan/bigfileuploader","_rev":"2-48fe4df9afd841447d1f8be612fff378","name":"@chao_yan/bigfileuploader","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@chao_yan/bigfileuploader","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@chao_yan/bigfileuploader@1.0.0","maintainers":[{"name":"chao_yan","email":"chaoyan024@gmail.com"}],"dist":{"shasum":"69da0d364d9403ceb551356f4abb36c782491c41","tarball":"https://registry.npmjs.org/@chao_yan/bigfileuploader/-/bigfileuploader-1.0.0.tgz","fileCount":9,"integrity":"sha512-azDu+Fnf1uStjRMowy2j6Fp9/RMNJNUkbdfPxZpJJQ92njshiYyL31R3YhGhdJGYEWw4+sMBzk/fgcYpcsHrYg==","signatures":[{"sig":"MEUCIQDTmdIWoK4tsQoFdhwbCbzEoI4ZakqPeg4ODFsqTtCMTAIgVbY+iwx0ZO0O7UepmhOOjr1oc3ee6n81iM5lXFvtQLc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7785},"main":"BigFileUploader.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"chao_yan","email":"chaoyan024@gmail.com"},"_npmVersion":"9.5.1","description":"mkdir file-upload-sdk cd file-upload-sdk npm init -y npm install typescript vite tsup spark-md5 npx tsc --init","directories":{},"_nodeVersion":"16.16.0","dependencies":{"tsup":"^8.5.0","vite":"^7.1.12","spark-md5":"^3.0.2","typescript":"^5.9.3"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/bigfileuploader_1.0.0_1761362763268_0.999710824017559","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@chao_yan/bigfileuploader","version":"1.0.1","description":"A TypeScript SDK for large file upload with chunking, concurrency, and resume support","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsup","prepublishOnly":"npm run build"},"keywords":["upload","big file","sdk","resume","concurrent","typescript"],"author":{"name":"chao_yan"},"license":"MIT","publishConfig":{"access":"public"},"dependencies":{"spark-md5":"^3.0.2","tsup":"^8.5.0","typescript":"^5.9.3","vite":"^7.1.12"},"devDependencies":{"@types/spark-md5":"^3.0.5"},"_id":"@chao_yan/bigfileuploader@1.0.1","_nodeVersion":"16.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-0/aDhrAMLrFVI7uYJjyvqGaiA+fQuLk7M2mS6MaS3wB6DXTgFPXEyQm349bEP8t1AV6aS4lrkrq+kE8/m5JaZQ==","shasum":"acd8b46d8fcdb602530f82798237c8cbd35fb8d5","tarball":"https://registry.npmjs.org/@chao_yan/bigfileuploader/-/bigfileuploader-1.0.1.tgz","fileCount":13,"unpackedSize":23367,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEMCH35KJzx1J7ntYZAUX2BLY8qX5qeCQRYS4wXqKDi6azECIB5BWKeTqu+UixvytoYVSxRH7oCBbH6TcgUv23YLBVrp"}]},"_npmUser":{"name":"chao_yan","email":"chaoyan024@gmail.com"},"directories":{},"maintainers":[{"name":"chao_yan","email":"chaoyan024@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bigfileuploader_1.0.1_1761375234653_0.3789003031896174"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-25T03:26:03.109Z","modified":"2025-10-25T06:53:55.032Z","1.0.0":"2025-10-25T03:26:03.468Z","1.0.1":"2025-10-25T06:53:54.841Z"},"license":"MIT","keywords":["upload","big file","sdk","resume","concurrent","typescript"],"description":"A TypeScript SDK for large file upload with chunking, concurrency, and resume support","maintainers":[{"name":"chao_yan","email":"chaoyan024@gmail.com"}],"readme":"# 🚀 @chao_yan/bigfileuploader\n\n一个支持 **分片上传、大文件断点续传、并发控制、MD5 校验** 的前端上传 SDK。  \n使用 TypeScript 编写，轻量、易扩展，适合二次封装到任意上传业务中。\n\n---\n\n## ✨ 特性\n\n- ⚡ **分片上传**：自动将大文件切割为小块上传  \n- 🧩 **并发控制**：限制同时上传的请求数量，防止卡顿  \n- 🧠 **断点续传**：支持中断后从已完成分片继续  \n- 🔐 **MD5 校验**：计算文件唯一标识，用于秒传与分片校验  \n- 🪶 **轻量可扩展**：无第三方 UI 依赖，可灵活集成到任意项目  \n- 📦 **TypeScript 支持**：完整类型定义与开发体验  \n\n---\n\n## 📦 安装\n\n```bash\nnpm install @chao_yan/bigfileuploader\n# 或使用 yarn\nyarn add @chao_yan/bigfileuploader\n\n```\n\n---\n\n## 📝 使用\n\n```ts\nimport { FileUploader } from '@chao_yan/bigfileuploader'\n\nconst file = document.querySelector('input[type=\"file\"]').files[0]\nconst uploader = new FileUploader(file, {\n  url: 'http://localhost:3000/upload',\n  chunkSize: 1024 * 1024 * 5, // 分片大小\n  concurrent: 3, // 并发数\n  retry: 3, // 重试次数\n\n  // 上传前钩子\n  beforeUpload: (file) => {\n      \n  }\n```\n---\n\n## 📖 API\n\n\n### FileUploader\n\n#### 构造函数\n\n```ts\nconstructor(file: File, options: FileUploaderOptions)\n```\n\n#### 方法\n\n```ts\nstart(): Promise<void> // 开始上传\npause(): void // 暂停上传\non(event: string, callback: Function): void // 监听事件\n```\n\n#### 事件\n\n```ts\non('start', callback: Function) // 上传开始\non('progress', callback: Function) // 上传进度\non('success', callback: Function) // 上传成功\non('error', callback: Function) // 上传失败\non('complete', callback: Function) // 上传完成\n```\n\n#### 配置项\n\n```ts\ninterface FileUploaderOptions {\n  url: string // 上传接口地址\n  chunkSize: number // 分片大小\n  concurrent: number // 并发数\n  retry: number // 重试次数\n  beforeUpload?: (file: File) => void // 上传前钩子\n  afterUpload?: (file: File) => void // 上传后钩子\n}\n```\n\n---\n\n\n##  目录结构\nfile-upload-sdk/\n├── src/\n│   ├── index.ts        // 导出入口\n│   ├── uploader.ts     // 主类 FileUploader\n│   ├── utils/\n│   │   ├── chunk.ts    // 分片工具\n│   │   ├── hash.ts     // 文件hash\n│   │   ├── retry.ts    // 重试机制\n│   │   └── request.ts  // 并发控制\n├── example/\n│   └── demo.html       // 测试页面\n├── package.json\n├── tsconfig.json\n└── README.md\n\n---\n\n## 🧾 License | 开源许可\n\n本项目基于 **MIT License** 开源许可协议发布。\n\nCopyright (c) 2025 chao_yan\n\n本软件及其文档可免费使用、复制、修改、合并、发布和分发，  \n前提是必须在所有副本中保留上述版权声明和本许可说明。\n\n本软件按 “原样” 提供，作者 **不承担任何责任或保证**。  \n使用者应自行承担因使用本软件所产生的风险。\n\n---\n\n### 📘 English Version\n\nThis project is licensed under the **MIT License**.\n\nCopyright (c) 2025 chao_yan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"),  \nto deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,  \nand/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n**THE SOFTWARE IS PROVIDED \"AS IS\"**, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,  \nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,  \nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n📄 [查看完整许可证 →](./LICENSE)\n","readmeFilename":"readme.md","author":{"name":"chao_yan"}}