# @rpldy/chunked-sender

> adds chunked upload capabilities on top of the regular XHR uploads

Latest version **1.13.0** (published 2025-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rpldy/chunked-sender
pnpm add @rpldy/chunked-sender
yarn add @rpldy/chunked-sender
bun add @rpldy/chunked-sender
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.13.0 |
| Published | 2025-11-26 |
| First published | 2020-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 44.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yoav niran (https://github.com/yoavniran) |
| Maintainers | yoavniran |
| Keywords | chunked, upload, send, file upload |

## Links

- npm: https://www.npmjs.com/package/@rpldy/chunked-sender
- Repository: https://github.com/rpldy/react-uploady
- Homepage: https://react-uploady.org
- Funding: https://opencollective.com/react-uploady
- npm.io page: https://npm.io/package/@rpldy/chunked-sender

## Dependencies (3)

- [@rpldy/sender](https://npm.io/package/@rpldy/sender.md) 1.13.0
- [@rpldy/shared](https://npm.io/package/@rpldy/shared.md) 1.13.0
- [@rpldy/simple-state](https://npm.io/package/@rpldy/simple-state.md) 1.13.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.13.0 (latest) — 2025-11-26
- 1.12.0-rc.0 (next) — 2025-10-28
- 1.4.2-alpha.0 (alpha) — 2023-03-27
- 1.12.0 — 2025-10-30
- 1.11.0 — 2025-07-18
- 1.10.0 — 2025-04-18
- 1.9.1 — 2025-02-07
- 1.9.0 — 2024-12-13
- 1.9.0-rc.2 — 2024-12-08
- 1.9.0-rc.1 — 2024-11-10
- 1.9.0-rc.0 — 2024-11-04
- 1.8.3 — 2024-08-19
- 1.8.2 — 2024-07-30
- 1.8.1 — 2024-05-16
- 1.8.0 — 2024-02-22
- … 94 more at https://npm.io/package/@rpldy/chunked-sender/versions

## README

<a href="https://opencollective.com/react-uploady">
    <img src="https://img.shields.io/opencollective/all/react-uploady?style=flat&logo=opencollective&label=Support%20us!&color=blue" alt="Support on Open Collective"/>
</a>
<a href="https://badge.fury.io/js/%40rpldy%2Fchunked-sender">
    <img src="https://badge.fury.io/js/%40rpldy%2Fchunked-sender.svg" alt="npm version" height="20"></a>
<a href="https://github.com/rpldy/react-uploady/actions/workflows/pr.yml">
        <img src="https://github.com/rpldy/react-uploady/actions/workflows/pr.yml/badge.svg" alt="Build Status"/></a>  
<a href="https://codecov.io/gh/rpldy/react-uploady">
    <img src="https://codecov.io/gh/rpldy/react-uploady/branch/master/graph/badge.svg" alt="codecov status"/></a> 
<a href="https://bundlephobia.com/result?p=@rpldy/chunked-sender">
    <img src="https://badgen.net/bundlephobia/minzip/@rpldy/chunked-sender" alt="bundlephobia badge"/></a>
<a href="https://react-uploady-storybook.netlify.app/?path=/docs/core-chunked-sender--docs">
   <img src="https://cdn.jsdelivr.net/gh/storybookjs/brand@master/badge/badge-storybook.svg" alt="rpldy storybook"/></a> 

# Chunked Sender

Adds chunked upload capabilities on top of the regular XHR [@rpldy/sender](https://react-uploady.org/docs/packages/rpldy-sender/)
Exposes an UploaderEnhancer that replaces the default send method the [uploader](https://react-uploady.org/docs/packages/rpldy-uploader/) uses.

For usage with your React app, see [@rpldy/chunked-uploady](https://react-uploady.org/docs/packages/rpldy-chunked-uploady/).

Chunked uploading doesn't support grouped uploads (in single XHR request) or URL uploading. 
These will be handed over to the default [@rpldy/sender](https://react-uploady.org/docs/packages/rpldy-sender/)

**The best place to get started is at our: [React-Uploady Documentation Website](https://react-uploady.org)**

## Installation

```shell
#Yarn:
  $ yarn add @rpldy/chunked-sender

#NPM:
  $ npm i @rpldy/chunked-sender
``` 

## Options

| Name (* = mandatory) | Type    | Default | Description                                                             |
|----------------------|---------|---------|-------------------------------------------------------------------------|
| chunked              | boolean | true    | chunk uploads. setting to false will return to default sending behavior |
| chunkSize            | number  | 5242880 | the chunk size. relevant when uploaded file is larger than the value    |
| retries              | number  | 0       | how many times to retry sending a failed chunk                          |
| parallel             | number  | 0       | how many (chunk) requests to send simultaneously                        |
| sendWithRangeHeader  | boolean | true    | whether to include the Content-Range header per chunk request           |

## Events

Chunked Sender makes it possible to handle chunk life-time events.
See [uploader events](https://react-uploady.org/docs/api/events/) section on more info regarding how to register for events.

### CHUNK_EVENTS.CHUNK_START

Triggered when a chunk is about to be sent to the server

> This event is _[cancellable](https://react-uploady.org/docs/api/events/#cancellable-events)_

The event handler may return an object with the following shape: 

```javascript
type StartEventResponse = {
	url: string,
    sendOptions: SendOptions
}
``` 

> * [SendOptions](https://react-uploady.org/docs/api/types/#sendoptions)

### CHUNK_EVENTS.CHUNK_FINISH

Triggered when a chunk has finished uploading

### Item Error

In case of chunk upload error in conjunction of using the [ITEM_ERROR](https://react-uploady.org/docs/api/events/#itemError) or the
[useItemErrorListener](https://react-uploady.org/docs/api/hooks/useItemErrorListener/) hook, it is possible to access the error information returned from the server like so:

```jsx

import { useItemErrorListener } from "@rpldy/uploady";

const MyComponent = () => {
    useItemErrorListener((item) => {
        console.log(`item ${item.id} failed -  status code:`, item.uploadResponse.chunkUploadResponse.status); //the status code returned by the server on the failed chunk
        console.log(`item ${item.id} failed -  msg:`, item.uploadResponse.chunkUploadResponse.response); //the response data (if) sent by the server on the failed chunk
    });

    //...
};
```

---
_Source: https://npm.io/package/@rpldy/chunked-sender · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
