@rpldy/chunked-sender

adds chunked upload capabilities on top of the regular XHR uploads

Usage no npm install needed!

<script type="module">
  import rpldyChunkedSender from 'https://cdn.skypack.dev/@rpldy/chunked-sender';
</script>

README

npm version circleci status codecov status bundlephobia badge rpldy storybook

Chunked Sender

Adds chunked upload capabilities on top of the regular XHR @rpldy/sender Exposes an UploaderEnhancer that replaces the default send method the uploader uses.

For usage with your React app, see @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

The best place to get started is at our: React-Uploady Documentation Website

Installation

#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

Events

Chunked Sender makes it possible to handle chunk life-time events. See uploader 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

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

type StartEventResponse = {
    url: string,
    sendOptions: ChunkedSendOptions
}

CHUNK_EVENTS.CHUNK_FINISH

Triggered when a chunk has finished uploading