Socket
Socket
Sign inDemoInstall

@rpldy/chunked-uploady

Package Overview
Dependencies
17
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @rpldy/chunked-uploady

wrapper&context component to expose and provide react-uploady functionality with chunked upload support


Version published
Weekly downloads
1.2K
decreased by-21.44%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.4.1 (2023-03-22)

Bug fixes

  • [ui-shared] - add globalThis to avoid error on edge runtime. Fix for #495

Internal

  • all - misc upgrade dev deps

Readme

Source
npm version circleci status codecov status bundlephobia badge rpldy storybook

Chunked Uploady

This package is provided as a convenient alternative to the main Uploady package. To be used in case chunked upload is required.

The server that is accepting the upload must also support chunked uploads. The original file is broken down into smaller blobs, which are sent in different requests. Each request is sent with the Content-Range header to specify the bytes range.

Internally, ChunkedUploady uses @rpldy/chunked-sender instead of the default sender.

Chunked-Sender, doesn't support grouped uploads (see Upload Options documentation) or URL uploading. These will be handed over to the default @rpldy/sender.

In case the browser doesn't support chunking (blob slicing), the default sender will be used as well.

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

Installation

#Yarn: 
   $ yarn add @rpldy/chunked-uploady

#NPM:
   $ npm i @rpldy/chunked-uploady

Note that you don't need @rpldy/uploady, it comes with.

Props

Name (* = mandatory)TypeDefaultDescription
chunkedbooleantruechunk uploads. setting to false will return to default sending behavior
chunkSizenumber5242880the chunk size. relevant when uploaded file is larger than the value
retriesnumber0how many times to retry sending a failed chunk
parallelnumber0how many (chunk) requests to send simultaneously

In addition, all UploadOptions props can be passed to ChunkedUploady. In order to override configuration passed to the parent Uploady component. See Uploady documentation for detailed list of upload options.

Hooks

Chunked Uploady provides hooks for chunk life-time events:

useChunkStartListener

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

This event is cancellable

import { useChunkStartListener } from "@rpldy/chunked-uploady";

const MyComponent = () => {
    useChunkStartListener((data) => {
        return {
            url: `${data.url}/${data.chunk.index}`
        };  
    });   
};

useChunkFinishListener

Called when a chunk has finished uploading

Example

import { useChunkFinishListener } from "@rpldy/chunked-uploady";

const MyComponent = () => {
    useChunkFinishListener(({ chunk }) => {
        console.log(`Chunk Finished - ${chunk.id} - attempt: ${chunk.attempt}`);
    });
};

Keywords

FAQs

Last updated on 22 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc