Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atlaskit/chunkinator

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/chunkinator

Upload large files from the browser with ease

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

chunkinator

Upload large files from the browser with ease

Pipeline pieces description

See examples/integrator.ts for good example of usage.

import {chunkinator} from '@atlaskit/chunkinator';

chunkinator is a main customizable high level component that gives you a way to upload large files. It takes a file as an input and pushes it through Observable pipe that consist of the following parts:

  • slicenator
  • hashinator
  • uploadinator
  • processinator

As a second argument chunkinator takes configuration options with following interface:

interface Options {
  chunkSize: number;
  hashingConcurrency: number;
  hashingFunction?: HashingFunction;
  uploadingConcurrency: number;
  uploadingFunction: UploadingFunction;
  processingBatchSize: number;
  processingFunction?: ProcessingFunction;
}

As a third argument chunkinator takes list of handy callbacks. Currently there is only one: onProgress.

slicenator

This component takes a blob, chunk size and returns Observable sequential stream of blob chunks.

Options' chunkSize is what defines chunk size

hashinator

This component takes stream of blobs and hashes each chunk. Returning stream contains blob and it's hash.

Options' hashingConcurrency defines how many chunks are hashed at the same time. hashingFunction is optional hashing function. If hashingFunction is not provided SHA-1 will be used instead.

uploadinator

This component takes hashed blobs and uploads them if blob doesn't exists on a backend.

Options' uploadingFunction is a callback that takes a blob and uploads it to the server. uploadingConcurrency controls how many of these calls happens at the same time.

processinator

With this component consumer has an opportunity to finalize already uploaded chunks in some way.

Options' processingFunction defines a function that is called with sequential batches of uploaded chunks. processingBatchSize controls how many uploaded chunks are given to processing function.

onProgress callback

This callback is called with every uploaded chunk. The only argument it is called with a portion of already uploaded chunks to it's total number.

FAQs

Package last updated on 21 Aug 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc