{"id":28327434,"url":"https://github.com/kukhariev/uploadx-client","last_synced_at":"2026-03-01T22:02:24.780Z","repository":{"id":293424379,"uuid":"983980165","full_name":"kukhariev/uploadx-client","owner":"kukhariev","description":"A JavaScript client for resumable uploads with chunking support.","archived":false,"fork":false,"pushed_at":"2025-10-06T06:44:34.000Z","size":298,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T08:44:07.679Z","etag":null,"topics":["chunked-uploads","resumable","upload","uploadx"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kukhariev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-15T07:58:38.000Z","updated_at":"2025-10-06T06:44:38.000Z","dependencies_parsed_at":"2025-10-06T08:28:57.032Z","dependency_job_id":"650b7978-9bef-42d6-a3c9-584f1e0df6fc","html_url":"https://github.com/kukhariev/uploadx-client","commit_stats":null,"previous_names":["kukhariev/uploadx-client"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kukhariev/uploadx-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukhariev%2Fuploadx-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukhariev%2Fuploadx-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukhariev%2Fuploadx-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukhariev%2Fuploadx-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kukhariev","download_url":"https://codeload.github.com/kukhariev/uploadx-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kukhariev%2Fuploadx-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29986241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T21:06:37.093Z","status":"ssl_error","status_checked_at":"2026-03-01T21:05:45.052Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chunked-uploads","resumable","upload","uploadx"],"created_at":"2025-05-26T02:18:52.495Z","updated_at":"2026-03-01T22:02:24.753Z","avatar_url":"https://github.com/kukhariev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UploadX Client\n\n[![npm version][npm-image]][npm-url]\n\n\u003c!-- [![commits since latest release][comm-image]][comm-url] --\u003e\n\nA JavaScript client for resumable file uploads with chunking support. Works with [node-uploadx](https://github.com/kukhariev/node-uploadx) server implementation.\n\n## Features\n\n- **Resumable Uploads**: Continue uploads from where they left off after interruptions\n- **Chunked Uploads**: Split large files into manageable chunks\n- **Progress Tracking**: Real-time upload progress monitoring\n- **Cross-Platform**: Works in both browser and Node.js environments\n- **Multiple Data Sources**: Support for File, Blob, Stream, Buffer, and more\n- **Automatic Retries**: Built-in retry mechanism with exponential backoff\n- **Cancellation**: Ability to abort ongoing uploads\n\n## Installation\n\n```bash\nnpm install @uploadx/client\n```\n\n## Usage\n\n### Basic File Upload (Node.js)\n\n```typescript\nimport { UploadxClient } from \"@uploadx/client\";\nimport fs from \"node:fs\";\n\nasync function uploadFile() {\n  // Create a new client instance\n  const client = new UploadxClient({\n    chunkSize: 8 * 1024 * 1024, // 8MB chunks\n  });\n\n  const filePath = \"./large-file.mp4\";\n  const stats = await fs.promises.stat(filePath);\n\n  // Upload the file\n  await client.fileUpload(\n    \"https://your-server.com/upload\",\n    filePath,\n    {\n      name: \"uploaded-file.mp4\",\n      mimeType: \"video/mp4\",\n      size: stats.size,\n      lastModified: stats.mtimeMs,\n    },\n    (progress) =\u003e {\n      console.log(`Upload progress: ${(progress * 100).toFixed(2)}%`);\n    }\n  );\n\n  console.log(\"Upload completed successfully!\");\n}\n\nuploadFile().catch(console.error);\n```\n\n### Browser Upload (with File object)\n\n```typescript\nimport { UploadxClient } from \"@uploadx/client\";\n\nasync function uploadFile(file) {\n  const client = new UploadxClient();\n\n  await client.upload(\n    \"https://your-server.com/upload\",\n    file,\n    {\n      name: file.name,\n      mimeType: file.type,\n      size: file.size,\n      lastModified: file.lastModified,\n    },\n    (progress) =\u003e {\n      updateProgressBar(progress);\n    }\n  );\n\n  alert(\"Upload completed!\");\n}\n\n// Example with file input\ndocument.getElementById(\"fileInput\").addEventListener(\"change\", (event) =\u003e {\n  const file = event.target.files[0];\n  if (file) {\n    uploadFile(file);\n  }\n});\n```\n\n### Manual Upload Session\n\nYou can manually create an upload session and then upload data to it. This is useful when you need more control over the upload process or when implementing custom upload workflows:\n\n```typescript\nimport { UploadxClient } from \"@uploadx/client\";\nimport fs from \"node:fs\";\n\nasync function manualUploadSession() {\n  const client = new UploadxClient();\n  const filePath = \"./large-file.mp4\";\n\n  // Get file stats for metadata\n  const stats = await fs.promises.stat(filePath);\n\n  // Define metadata\n  const metadata = {\n    name: \"manual-upload.mp4\",\n    mimeType: \"video/mp4\",\n    size: stats.size,\n    lastModified: stats.mtimeMs,\n  };\n\n  try {\n    // Create upload session\n    const session = await client.createUpload(\n      // or createFileUpload\n      \"https://your-server.com/upload\",\n      metadata\n    );\n\n    console.log(`Upload session created: ${session.url}`);\n    console.log(`Already uploaded bytes: ${session.uploadedBytes || 0}`);\n\n    // Now you can use the session URL to resume the upload\n    if (session.uploadedBytes !== undefined) {\n      console.log(`Resuming upload from byte ${session.uploadedBytes}`);\n    }\n\n    await client.resumeFileUpload(\n      session.url,\n      filePath,\n      metadata,\n      (progress) =\u003e {\n        console.log(`Upload progress: ${(progress * 100).toFixed(2)}%`);\n      }\n    );\n\n    console.log(\"Upload completed successfully!\");\n  } catch (error) {\n    console.error(\"Upload session failed:\", error);\n  }\n}\n\nmanualUploadSession().catch(console.error);\n```\n\n## API Reference\n\n### `UploadxClient`\n\n#### Constructor\n\n```typescript\nnew UploadxClient(config?: UploadConfig)\n```\n\n**Parameters:**\n\n- `config` (optional): Configuration options\n  - `chunkSize`: Size of each chunk in bytes (default: 5MB)\n  - `retryConfig`: Configuration for axios-retry\n  - `requestConfig`: Configuration for axios requests\n\n#### Methods\n\n##### `fileUpload`\n\nUploads a file from disk (Node.js only).\n\n```typescript\nfileUpload(\n  endpoint: string,\n  filePath: string,\n  metadata: UploadMetadata,\n  onProgress?: ProgressCallback,\n  signal?: AbortSignal\n): Promise\u003cvoid\u003e\n```\n\n##### `upload`\n\nUploads data from various sources (Blob, File, Stream, Buffer).\n\n```typescript\nupload(\n  endpoint: string,\n  data: Uploadable,\n  metadata: UploadMetadata,\n  onProgress?: ProgressCallback,\n  signal?: AbortSignal\n): Promise\u003cvoid\u003e\n```\n\n##### `resumeUpload`\n\nResumes an upload from a previously created session.\n\n```typescript\nresumeUpload(\n  url: string,\n  data: Uploadable,\n  metadata: UploadMetadata,\n  onProgress?: ProgressCallback,\n  signal?: AbortSignal\n): Promise\u003cvoid\u003e\n```\n\n##### `resumeFileUpload`\n\nResumes a file upload from disk (Node.js only).\n\n```typescript\nresumeFileUpload(\n  url: string,\n  filePath: string,\n  metadata: UploadMetadata,\n  onProgress?: ProgressCallback,\n  signal?: AbortSignal\n): Promise\u003cvoid\u003e\n```\n\n##### `createUpload`\n\nCreates a new upload session on the server.\n\n```typescript\ncreateUpload(\n  endpoint: string,\n  metadata: UploadMetadata,\n  signal?: AbortSignal\n): Promise\u003c{ url: string; uploadedBytes?: number }\u003e\n```\n\n##### `updateUpload`\n\nUpdates metadata for an existing upload.\n\n```typescript\nupdateUpload(\n  url: string,\n  metadata: Partial\u003cUploadMetadata\u003e,\n  signal?: AbortSignal\n): Promise\u003cvoid\u003e\n```\n\n##### `getUploadStatus`\n\nGets the current upload progress from the server.\n\n```typescript\ngetUploadStatus(\n  url: string,\n  metadata?: Partial\u003cUploadMetadata\u003e,\n  signal?: AbortSignal\n): Promise\u003c{ uploadedBytes: number }\u003e\n```\n\n##### `deleteUpload`\n\nDeletes an existing upload from the server.\n\n```typescript\ndeleteUpload(url: string, signal?: AbortSignal): Promise\u003cvoid\u003e\n```\n\n##### `abort`\n\nAborts all ongoing upload operations.\n\n```typescript\nabort(): void\n```\n\n## Types\n\n### `UploadMetadata`\n\n```typescript\ninterface UploadMetadata {\n  name: string;\n  mimeType?: string;\n  size: number;\n  lastModified?: number;\n  [key: string]: unknown;\n}\n```\n\n### `ProgressCallback`\n\n```typescript\ntype ProgressCallback = (progress: number) =\u003e void;\n```\n\n## Examples\n\nThe repository includes example code to help you get started:\n\n### Upload Client Example\n\n[examples/client.ts](examples/client.ts) demonstrates how to upload a file with progress tracking:\n\n```bash\nts-node examples/client.ts /path/to/file.mp4\n```\n\n### Browser Example\n\nThe repository includes a browser demo ([examples/browser/index.html](examples/browser/index.html)) that shows how to implement resumable uploads in web applications with progress tracking, session management, and upload controls (upload, abort, resume, delete).\n\n## Server Requirements\n\nThis client is specifically designed to work with the [node-uploadx](https://github.com/kukhariev/node-uploadx) server implementation, which provides the necessary protocol support for resumable uploads.\n\n## License\n\nMIT\n\n[npm-image]: https://img.shields.io/npm/v/@uploadx/client.svg\n[npm-url]: https://www.npmjs.com/package/@uploadx/client\n[comm-image]: https://img.shields.io/github/commits-since/kukhariev/uploadx-client/latest\n[comm-url]: https://github.com/kukhariev/uploadx-client/releases/latest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkukhariev%2Fuploadx-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkukhariev%2Fuploadx-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkukhariev%2Fuploadx-client/lists"}