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

pure-upload

Package Overview
Dependencies
Maintainers
2
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pure-upload

The pure upload library without dependencies

  • 1.0.21
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
157
increased by12.95%
Maintainers
2
Weekly downloads
 
Created
Source

Pure-upload

npm version Bower version

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.

Installation

  1. Dowload as a ZIP file directly from GitHub pages and include to your project.
  2. Install with npm by npm install pure-upload --save.
  3. Install with bower by bower install pure-upload.

Example

See a simple example.

Api

Uploader

Uploader manages upload queue and registers upload areas.

Initialization:

var uploader = pu.getUploader(uploadQueueOptions, uploadQueueCallbacks)

Upload queue options

maxParallelUploads?: number;
autoStart?: boolean;
autoRemove?: boolean;

Upload queue callbacks

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:

var uploadArea = uploader.registerArea(element, uploadAreaOptions);

Registration for IE9- with manual-start:

var 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:

uploader.unregisterArea(uploadArea);

Upload area options

url: string;
method: string;
withCredentials?: boolean;
headers?: { [key: string]: any; };
params?: { [key: string]: any; };
maxFileSize?: number;
allowDragDrop?: boolean;
clickable?: boolean;
accept?: string;
multiple?: boolean;

Upload file

Standard File object extended with additional informations and methods to manage a file in queue.

guid: string;
uploadStatus: IUploadStatus;
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.

npm version

Keywords

FAQs

Package last updated on 18 Nov 2015

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