getChunkedEnhancer
Packageβ
Installationβ
- npm
- Yarn
- pnpm
npm install @rpldy/chunked-sender
yarn add @rpldy/chunked-sender
pnpm add @rpldy/chunked-sender
Detailsβ
type getChunkedEnhancer = (options: ChunkedOptions) => UploaderEnhancer
- See: ChunkedOptions
- See: UploaderEnhancer
Creates an uploader enhancer that can be handed to the Uploady (using the enhancer prop), or to the uploader.
warning
When using React, there's typically no need to use this enhancer directly. Using Chunked-Uploady will do this for you automatically.
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 |
Exampleβ
import Uploady from "@rpldy/uploady";
import { getChunkedEnhancer } from "@rpldy/chunked-sender";
const chunkedEnhancer = getChunkedEnhancer({
chunkSize: 1e+6
});
const App = () => (
<Uploady
destination={{ url: "https://my-server" }}
enhancer={chunkedEnhancer}
>
<RestOfMyApp/>
</Uploady>
)
See: composeEnhancers