# dice-mist

> A wrapper for the evaporate library allowing use in a web worker.

Latest version **0.1.0** (published 2023-09-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install dice-mist
pnpm add dice-mist
yarn add dice-mist
bun add dice-mist
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2023-09-13 |
| First published | 2018-09-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 690.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | endeavorstreaming-admin, mikiest |
| Keywords | S3 Upload, Web worker, Evaporate.js, Evaporatejs, Evaporate |

## Links

- npm: https://www.npmjs.com/package/dice-mist
- npm.io page: https://npm.io/package/dice-mist

## Dependencies (3)

- [evaporate](https://npm.io/package/evaporate.md) ^2.0.0
- [js-sha256](https://npm.io/package/js-sha256.md) ^0.9.0
- [spark-md5](https://npm.io/package/spark-md5.md) ^3.0.0

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2023-09-13
- 0.0.7 — 2019-05-17
- 0.0.6 — 2018-09-18
- 0.0.5 — 2018-09-18
- 0.0.4 — 2018-09-17
- 0.0.3 — 2018-09-14
- 0.0.2 — 2018-09-14
- 0.0.1 — 2018-09-14

## README

# Dice Mist

Dice Mist is a wrapper for the [Evaporate library](https://github.com/TTLabs/EvaporateJS) providing web worker support.

When uploading multiple large files, it is possible for the upload process to lag the main JS thread, by delegating this work to a web worker you can keep your UI snappy.

## Installation

`npm i dice-mist`

## Usage

```javascript
import Mist from 'dice-mist';

const config = {
    // evaporate config
    worker: true // boolean to use worker or not
};

const files = [
    // array of Javascript Files
    // you MUST add an ID to each file, so that it can be track from the worker
    // E.g: files.forEach(file => {file.id = generateId()});
];

Mist(config, files)
    .progress((progress, id) => { /* File upload % progress - number between 0 & 1 */})
    .success((id, data, awsObjectKey) => { /* fileGuid, fileData, s3 key/path */})
    .error((reason, id) => { /* error reason, errored file */})
    .start((cancel, id) => { /* function to cancel individual file upload, file id */});
```

### Web Worker Crypto Functions

For ease of instantiation the web work implementation does not accept MD5 or SHA256 functions from the config.
These are set to [js-spark-md5](https://github.com/satazor/js-spark-md5) and [js-sha256](https://github.com/emn178/js-sha256).

## How It Works

![Sequence Diagram](https://raw.githubusercontent.com/DiceTechnology/dice-mist/master/docs/sequence.png "Upload Sequence Diagram")

---
_Source: https://npm.io/package/dice-mist · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
