chunked-uploader
TypeScript icon, indicating that this package has built-in type declarations

0.2.9 • Public • Published

Library for uploading large files chunked

This is a library containing a collection of utilities for uploading large files.

The main utilities are:

  • prepareFile(): Will read a supplied file and create a list of chunks from it. Each chunk will be provided with a SHA-1 checksum. The function is working asynchroneously, as it might take a long time, depending on the size of the file and the browser the user is using. An EventEmitter is returned which will emit different usefull events during the whole process.
  • upload(): Will consume the list of chunks generated by prepareFile() and transfer each chunk to the backend. Will provide each chunk with a transfer status. This function also returns an EventEmitter which will emit relevant events during the transfer.

Usage

This is a library project which can not be started. It can be builded, tested and linted.

Before doing anything else it is neccessary to install all needed dependencies like so:

user@machine:~/project/$ npm install

Building

It is possible to build this library, compiling the typescript code into a single javascript bundle using webpack and generating a single index.d.ts typings file for use in typescript projects. To build the project simply run:

user@machine:~/project/$ npm run build

Testing

Code coverage and testing

You can run all the tests and get a coverage result by simply running the following:

user@machine:~/project/$ npm test

Multiple browsers are supported. Just set your BROWSER environment variable accordingly:

  • Firefox
  • Chrome
  • PhantomJS (For headless testing)

In order to test in one or more of them, just set the BROWSER environment variable to comma-seperated list like this:

user@machine:~/project/$ BROWSER=Chrome,Firefox npm test

Linting

In order to lint your code with tslint run:

user@machine:~/project/$ npm run lint

Dependencies (4)

Dev Dependencies (28)

Package Sidebar

Install

npm i chunked-uploader

Weekly Downloads

1

Version

0.2.9

License

none

Last publish

Collaborators

  • prior99