{"_rev":"4-315b652646d2dd6a6d68d95163f761b7","time":{"created":"2026-01-15T02:27:48.693Z","modified":"2026-01-15T02:27:49.243Z","0.0.6":"2026-01-10T17:41:27.025Z","0.0.7":"2026-01-15T02:27:49.004Z"},"_id":"@bedelightful/upload-sdk","name":"@bedelightful/upload-sdk","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.7":{"name":"@bedelightful/upload-sdk","version":"0.0.7","description":"Unified upload toolkit supporting Aliyun OSS, Volcengine TOS, and Huawei OBS, with planned support for Tencent COS, Qiniu Kodo, Baidu BOS, NetEase NOS, and more.","keywords":[],"repository":{"type":"git","url":"https://github.com/saashqdev/delightful/upload-sdk"},"license":"MIT","author":{"name":"BeDelightful"},"type":"module","exports":{".":{"import":{"types":"./dist/es/index.d.ts","default":"./dist/es/index.js"},"require":{"types":"./dist/lib/index.d.ts","default":"./dist/lib/index.js"}}},"main":"dist/lib/index.js","directories":{"test":"tests"},"scripts":{"prebuild":"rimraf dist","build":"npm run clean && tsup --config tsup.config.ts","clean":"rm -rf dist","lint":"eslint ./src --ext ts,tsx","lint:fix":"eslint ./src --ext ts,tsx --fix && prettier --write ./src/**/*.ts","test":"vitest run","test:watch":"vitest","test:ui":"vitest --ui"},"dependencies":{"@aws-sdk/client-s3":"^3.911.0","@babel/runtime":"^7.22.10","buffer":"^6.0.3","crypto-js":"^3.1.1","esdk-obs-browserjs":"^3.23.5","lodash-es":"~4.17.21","mime":"^3.0.0","process":"^0.11.10"},"devDependencies":{"@babel/eslint-parser":"^7.18.2","@bedelightful/eslint-config":"~0.0.11","@semantic-release/changelog":"^6.0.1","@semantic-release/commit-analyzer":"^9.0.2","@semantic-release/git":"^10.0.1","@semantic-release/gitlab":"^9.4.1","@semantic-release/npm":"^9.0.1","@semantic-release/release-notes-generator":"^10.0.3","@types/crypto-js":"^4.1.1","@types/lodash-es":"~4.17.12","@types/mime":"^3.0.1","@types/node":"^20.17.9","@types/qs":"^6.9.7","@vitest/coverage-v8":"^3.2.4","@vitest/ui":"^3.2.4","babel":"^6.23.0","babel-eslint":"^10.1.0","babel-plugin-import":"^1.13.8","babel-plugin-transform-react-remove-prop-types":"^0.4.24","colors":"^1.3.2","commitizen":"^3.0.0","coveralls":"^3.0.2","cross-env":"^5.2.0","cz-conventional-changelog":"^2.1.0","esbuild-plugin-copy":"^2.1.1","eslint":"^8.57.1","jsdom":"^25.0.1","mock-xmlhttprequest":"^8.2.0","prettier":"^3.5.3","prompt":"^1.0.0","react":"^18.2.0","react-dom":"^18.2.0","replace-in-file":"^3.4.2","rimraf":"^6.0.1","semantic-release":"^19.0.3","shelljs":"^0.8.3","travis-deploy-once":"^5.0.9","ts-node":"^10.9.2","tslib":"^2.4.0","tsup":"~8.0.2","typedoc":"^0.27.5","typescript":"^5.7.2","url":"^0.11.0","vitest":"^3.2.4"},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public"},"module":"dist/es/index.js","typings":"dist/es/index.d.ts","lint-staged":{"./src/**/*.{ts,tsx}":["eslint --fix","prettier --write ./src/**/*.ts","git add"]},"browserslist":["defaults","not IE 11","maintained node versions"],"_id":"@bedelightful/upload-sdk@0.0.7","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-eib1ztfZE7wjHG1loFAevAK2v7L5/FfEys1RuDfhRr7qTKhy9cCurBFJByd/eK65gf6YISNKSyaWllCP9MMMLw==","shasum":"d79476d055c963b6cd557dc1866ff2bf3e3c5904","tarball":"https://registry.npmjs.org/@bedelightful/upload-sdk/-/upload-sdk-0.0.7.tgz","fileCount":239,"unpackedSize":11338275,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFsFGRGbZIdcclIB9zYpLPqiFfz66X6e0m3nqawNseZAAiEA3xQ2FueVXUuke/o6+YpaIrYANl7jRsJWHjpTKc3IN2w="}]},"_npmUser":{"name":"gridworkz","email":"dave@gridworkz.com"},"maintainers":[{"name":"gridworkz","email":"dave@gridworkz.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/upload-sdk_0.0.7_1768444068753_0.5152669225175139"},"_hasShrinkwrap":false}},"maintainers":[{"name":"gridworkz","email":"dave@gridworkz.com"}],"description":"Unified upload toolkit supporting Aliyun OSS, Volcengine TOS, and Huawei OBS, with planned support for Tencent COS, Qiniu Kodo, Baidu BOS, NetEase NOS, and more.","keywords":[],"repository":{"type":"git","url":"https://github.com/saashqdev/delightful/upload-sdk"},"author":{"name":"BeDelightful"},"license":"MIT","readme":"﻿# Upload SDK\n\nUnified upload toolkit supporting Aliyun OSS, Volcengine TOS, and Huawei OBS, with planned support for Tencent COS, Qiniu Kodo, Baidu BOS, NetEase NOS, and more.\n\n## Quick Start\n\n1) Install @bedelightful/upload-sdk\n\n```bash\nnpm install @bedelightful/upload-sdk\n```\n\n2) Upload a file with upload-sdk (basic example):\n\n```ts\nconst uploadTask = uploadSDK.upload({\n  url: \"your back-end interface\",\n  method: \"GET\",\n  file: yourFile, // File\n  fileName: yourFileName, // File name\n  headers: {\n    \"request-id\": Date.now(),\n  },\n});\n\nif (uploadTask.success) {\n  uploadTask.success((res: result) =>\n    console.log(`Upload complete: ${JSON.stringify(res)}`),\n  );\n}\n\nif (uploadTask.progress) {\n  uploadTask.progress((percent, loaded, total) =>\n    console.log(`File upload progress: ${percent}%`, loaded, total),\n  );\n}\n\nif (uploadTask.fail) {\n  uploadTask.fail((response) => console.log(\"- fail response -\", response));\n}\n\n// ---------- Single upload task ----------\n// Cancel upload\nuploadTask.cancel();\n// Pause upload\nuploadTask.pause();\n// Resume upload\nuploadTask.resume();\n```\n\n## Upload Flow\n\n```mermaid\n---\ntitle: Upload SDK Flow\n---\n\nsequenceDiagram\n    Frontend-->>UploadSdk: Provide credential config\n    UploadSdk->>AppBackend: Send request for temporary upload credential\n    AppBackend->>BaseService: Add required params (platform, bucket, etc.) and request temporary credential\n    BaseService->>AppBackend: Return temporary credential\n    AppBackend-->>UploadSdk: Return temporary credential\n    UploadSdk-->>CloudPlatform: Upload file\n    CloudPlatform-->>BaseService: Trigger upload callback (Aliyun)\n    CloudPlatform-->>UploadSdk: Upload succeeded\n    UploadSdk-->>Frontend: Return platform/path parameters\n    Frontend-->>AppBackend: Persist path and related info\n```\n\nNote: Volcengine does not currently support upload callbacks, but the flow remains unchanged.\n\n## Performance Features\n\n### Code splitting and on-demand loading\n\nStarting from version x.x.x, upload-sdk supports code splitting and on-demand loading of platform modules. Adapters are loaded only when needed, reducing initial bundle size and improving startup performance.\n\n#### Usage\n\nAsynchronous import (recommended):\n\n```typescript\nimport { Upload, loadPlatformModule, PlatformType } from \"@delightful/upload-sdk\";\n\n// Preload specific platform modules (optional)\nasync function preloadModules() {\n  // Load only required platform modules\n  await loadPlatformModule(PlatformType.ALiYun);\n  console.log(\"Aliyun module loaded\");\n}\n\n// Or auto-load during upload\nconst upload = new Upload();\nupload.upload({\n  url: \"your-api-url\",\n  method: \"POST\",\n  file: yourFile,\n  fileName: \"example.jpg\",\n  // ... other options\n});\n```\n\nCompatibility mode (backward-compatible):\n\n```typescript\nimport { Upload } from \"@delightful/upload-sdk\";\n\n// Continue using the original approach; SDK will lazy-load internally\nconst upload = new Upload();\n// ... other code unchanged\n```\n\n## Supported Platforms\n\n| Platform     | Status          | Notes                                            |\n| ------------ | ---------------- | ------------------------------------------------ |\n| Aliyun OSS   | ✅ Supported     | Multipart upload, checkpoint resume supported    |\n| Volcengine TOS | ✅ Supported   | Multipart upload, checkpoint resume supported    |\n| Huawei OBS   | ✅ Supported     | Multipart upload, checkpoint resume supported    |\n| Qiniu Kodo   | ✅ Supported     | Basic upload supported                           |\n| Tencent COS  | 🔄 Planned       | In development                                   |\n| Baidu BOS    | 🔄 Planned       | In development                                   |\n| NetEase NOS  | 🔄 Planned       | In development                                   |\n| MinIO/S3     | ✅ Supported     | Multipart upload, checkpoint resume supported    |\n| Azure Blob   | 🔄 Planned       | In development                                   |\n\n> For platforms not yet supported, please open an issue or PR to help us prioritize.\n\n\n\n\n","readmeFilename":"README.md"}