# pure-upload-as-js

> The pure upload library without dependencies

Latest version **2.0.7** (published 2016-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install pure-upload-as-js
pnpm add pure-upload-as-js
yarn add pure-upload-as-js
bun add pure-upload-as-js
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.7 |
| Published | 2016-11-03 |
| First published | 2016-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | t.rut, m.horyna |
| Maintainers | prabhap |
| Keywords | pure, upload, javascript, typescript, web, file, api |

## Links

- npm: https://www.npmjs.com/package/pure-upload-as-js
- Repository: https://github.com/prabhap/pure-upload
- Homepage: https://github.com/prabhap/pure-upload#readme
- Issues: https://github.com/prabhap/pure-upload/issues
- npm.io page: https://npm.io/package/pure-upload-as-js

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.0.7 (latest) — 2016-11-03
- 2.0.6 — 2016-11-03

## README

# Pure-upload
[![npm version](https://badge.fury.io/js/pure-upload.svg)](http://badge.fury.io/js/pure-upload)  [![Bower version](https://badge.fury.io/bo/pure-upload.svg)](http://badge.fury.io/bo/pure-upload)

The pure JS (TS) upload library with no dependencies compatible with Google Chrome, Firefox, IE10+ (IE9- with auto-start by default, manual-start optionally) and mobile browsers.

## Example
See a simple [example](http://keeema.github.io/pure-upload).

## Api
### Uploader
Uploader manages upload queue and registers upload areas.

Initialization:
```typescript
let uploader = pu.getUploader(uploadQueueOptions, uploadQueueCallbacks)
```
### Upload queue options
```typescript
maxParallelUploads?: number;
autoStart?: boolean;
autoRemove?: boolean;
```
### Upload queue callbacks
```typescript
onProgressCallback?: (file: IUploadFile) => void;
onCancelledCallback?: (file: IUploadFile) => void;
onFinishedCallback?: (file: IUploadFile) => void;
onUploadedCallback?: (file: IUploadFile) => void;
onErrorCallback?: (file: IUploadFile) => void;
onUploadStartedCallback?: (file: IUploadFile) => void;
onFileAddedCallback?: (file: IUploadFile) => void;
onFileRemovedCallback?: (file: IUploadFile) => void;
onAllFinishedCallback?: () => void;
onQueueChangedCallback?: (queue: IUploadFile[]) => void;
onFilesAddedErrorCallback?: (files: IUploadFile[]) => void;
```

### Upload area
Upload area defines element registred in Uploader.

Registration:
```typescript
let uploadArea = uploader.registerArea(element, uploadAreaOptions);
```

Registration for IE9- with manual-start:
```typescript
let uploadArea = uploader.registerArea(element, uploadAreaOptions, compatibilityForm);
```
The *compatibilityForm* objects has to be *form* element containing one *input* element for *file* and one *input* element for *submit*.

Unregistration:
```typescript
uploader.unregisterArea(uploadArea);
```
### Upload area options
```typescript
url: string;
method: string;
withCredentials?: boolean;
headers?: { [key: string]: string; };
params?: { [key: string]: string; };
maxFileSize?: number;
allowDragDrop?: boolean;
clickable?: boolean;
accept?: string;
multiple?: boolean;
onFileAdded?: (file: IUploadFile) => void;
onFileError?: (file: IUploadFile) => void; 
onFileCancelled?: (file: IUploadFile) => void; 
```

### Upload file
Standard *File* object extended with additional informations and methods to manage a file in queue.
```typescript
guid: string;
uploadStatus: UploadStatus;
responseCode: number;
responseText: string;
progress: number;
sentBytes: number;
cancel: () => void;
remove: () => void;
start: () => void;
```

### Upload status
File statuses accesible by `pu.uploadStatus`.

Library used by [GMC Software Technology](http://www.gmchk.cz).

[![npm version](https://media.licdn.com/mpr/mpr/shrink_200_200/AAEAAQAAAAAAAAKkAAAAJDA3MDA4ODRmLWM2ZjQtNDYyNi04NjY2LWFhZjk3NjU3NDg4MQ.png)](http://www.gmchk.cz)

MIT, Copyright &copy; 2015 Tomáš Růt

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