An open API service indexing awesome lists of open source software.

https://github.com/sunny-117/chunkflow

๐ŸŽ‰ A universal large file upload solution with chunked upload, resumable upload, and instant upload capabilities. | ้€š็”จ็š„ๅคงๆ–‡ไปถไธŠไผ ่งฃๅ†ณๆ–นๆกˆ๏ผŒๆ”ฏๆŒๅˆ†็‰‡ไธŠไผ ใ€ๆ–ญ็‚น็ปญไผ ๅ’Œ็ง’ไผ ๅŠŸ่ƒฝ
https://github.com/sunny-117/chunkflow

chunk fiber file http large-file-upload protocol rust turbo upload upload-client upload-component websocket

Last synced: about 2 hours ago
JSON representation

๐ŸŽ‰ A universal large file upload solution with chunked upload, resumable upload, and instant upload capabilities. | ้€š็”จ็š„ๅคงๆ–‡ไปถไธŠไผ ่งฃๅ†ณๆ–นๆกˆ๏ผŒๆ”ฏๆŒๅˆ†็‰‡ไธŠไผ ใ€ๆ–ญ็‚น็ปญไผ ๅ’Œ็ง’ไผ ๅŠŸ่ƒฝ

Awesome Lists containing this project

README

          


ChunkFlow Logo

ChunkFlow Upload SDK



A Universal Large File Upload Solution



npm version
license
GitHub stars



English | ็ฎ€ไฝ“ไธญๆ–‡



๐Ÿ“– Documentation


---

## โœจ Features

- ๐Ÿš€ **Smart Upload Strategy** - Automatic selection between direct and chunked upload based on file size
- ๐Ÿ“ฆ **Dynamic Chunking** - Adaptive chunk size adjustment based on network conditions (similar to TCP slow start)
- โšก **Instant Upload** - Hash-based deduplication for instant uploads (็ง’ไผ )
- ๐Ÿ”„ **Resumable Upload** - Continue uploads from where you left off with IndexedDB persistence
- ๐ŸŽฏ **Framework Agnostic** - Core layer works with any framework
- โš›๏ธ **React Support** - Hooks and components for React applications
- ๐Ÿ’š **Vue Support** - Composables and components for Vue applications
- ๏ฟฝ๏ธ **Highly Extensible** - Plugin system for custom functionality
- ๐Ÿ”’ **Type Safe** - Written in TypeScript with full type definitions
- ๐Ÿงช **Well Tested** - Comprehensive unit and property-based tests

## ๐Ÿ“ฆ Packages

### Core Packages

- **[@chunkflowjs/protocol](./packages/protocol)** - Protocol layer with type definitions and API interfaces
- **[@chunkflowjs/shared](./packages/shared)** - Shared utilities (event system, concurrency, file utils, storage)
- **[@chunkflowjs/core](./packages/core)** - Core upload engine with state machine and task management

### Client Packages

- **[@chunkflowjs/upload-client-react](./packages/upload-client-react)** - React adapter with hooks
- **[@chunkflowjs/upload-client-vue](./packages/upload-client-vue)** - Vue adapter with composables
- **[@chunkflowjs/upload-component-react](./packages/upload-component-react)** - Ready-to-use React components
- **[@chunkflowjs/upload-component-vue](./packages/upload-component-vue)** - Ready-to-use Vue components

### Server Package

- **[@chunkflowjs/upload-server](./packages/upload-server)** - Server-side SDK with storage adapters

## ๐Ÿš€ Quick Start

### Installation

```bash
# For React projects
pnpm add @chunkflowjs/core @chunkflowjs/upload-client-react

# For Vue projects
pnpm add @chunkflowjs/core @chunkflowjs/upload-client-vue
```

### React Usage

```tsx
import { UploadProvider, useUpload } from "@chunkflowjs/upload-client-react";
import { createFetchAdapter } from "@chunkflowjs/core";

const adapter = createFetchAdapter({
baseURL: "http://localhost:3000/api",
});

function App() {
return (



);
}

function UploadComponent() {
const { upload, status, progress } = useUpload({
onSuccess: (fileUrl) => console.log("Upload complete:", fileUrl),
onError: (error) => console.error("Upload failed:", error),
});

return (


{
const file = e.target.files?.[0];
if (file) upload(file);
}}
/>
Status: {status}

Progress: {progress.percentage}%


);
}
```

### Vue Usage

```html

import { useUpload } from "@chunkflowjs/upload-client-vue";

const { upload, status, progress } = useUpload({
onSuccess: (fileUrl) => console.log("Upload complete:", fileUrl),
onError: (error) => console.error("Upload failed:", error),
});

const handleFileChange = (event) => {
const file = event.target.files?.[0];
if (file) upload(file);
};



Status: {{ status }}

Progress: {{ progress.percentage }}%

```

## ๐Ÿ—๏ธ Architecture

ChunkFlow Upload SDK follows a layered architecture:

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Applications โ”‚
โ”‚ Playground (Demo) โ”‚ Server (Nest.js) โ”‚ Website (Docs) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Component Layer โ”‚
โ”‚ React Components โ”‚ Vue Components โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Client Adapter Layer โ”‚
โ”‚ React Hooks โ”‚ Vue Composables โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Core Layer โ”‚
โ”‚ Upload Manager โ”‚ Upload Task โ”‚ Plugin System โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Shared Layer โ”‚
โ”‚ Event System โ”‚ Concurrency โ”‚ File Utils โ”‚ Storage โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Protocol Layer โ”‚
โ”‚ Type Definitions โ”‚ API Interfaces โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

## ๐Ÿ“š Documentation

Full documentation is available at: [https://sunny-117.github.io/chunkflow/](https://sunny-117.github.io/chunkflow/)

## ๐Ÿ› ๏ธ Development

This project uses a monorepo structure managed by pnpm workspaces and Turbo.

### Prerequisites

- Node.js >= 18.0.0
- pnpm >= 9.0.0

### Setup

```bash
# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run tests
pnpm test

# Lint code
pnpm lint

# Format code
pnpm format
```

### Project Structure

```
chunkflow/
โ”œโ”€โ”€ packages/ # SDK packages
โ”‚ โ”œโ”€โ”€ protocol/ # Protocol layer
โ”‚ โ”œโ”€โ”€ shared/ # Shared utilities
โ”‚ โ”œโ”€โ”€ core/ # Core upload engine
โ”‚ โ”œโ”€โ”€ upload-client-react/ # React adapter
โ”‚ โ”œโ”€โ”€ upload-client-vue/ # Vue adapter
โ”‚ โ”œโ”€โ”€ upload-component-react/ # React components
โ”‚ โ”œโ”€โ”€ upload-component-vue/ # Vue components
โ”‚ โ””โ”€โ”€ upload-server/ # Server SDK
โ”œโ”€โ”€ apps/ # Applications
โ”‚ โ”œโ”€โ”€ server/ # Nest.js server
โ”‚ โ”œโ”€โ”€ playground/ # Demo application
โ”‚ โ””โ”€โ”€ website/ # Documentation site
โ”œโ”€โ”€ pnpm-workspace.yaml # Workspace configuration
โ”œโ”€โ”€ turbo.json # Turbo configuration
โ””โ”€โ”€ package.json # Root package.json
```

## ๐Ÿงช Testing

The project uses a dual testing approach:

- **Unit Tests** - Test specific examples and edge cases
- **Property-Based Tests** - Test universal properties across random inputs using fast-check

```bash
# Run all tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run tests with coverage
pnpm test -- --coverage
```

## ๐Ÿค Contributing

Contributions are welcome! Please read our [contributing guidelines](./CONTRIBUTING.md) before submitting a PR.

## ๐Ÿ“„ License

MIT ยฉ [Sunny-117](https://github.com/Sunny-117)

## ๐Ÿ™ Acknowledgments

- [mitt](https://github.com/developit/mitt) - Event emitter
- [p-limit](https://github.com/sindresorhus/p-limit) - Concurrency control
- [spark-md5](https://github.com/satazor/js-spark-md5) - MD5 hashing
- [fast-check](https://github.com/dubzzz/fast-check) - Property-based testing

---


Made with โค๏ธ by Sunny-117



โญ Star us on GitHub