You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.
Reinforces the Evaporate library to allow Angular-specific usage along with all the native functionality plus additional features. Available injectables:
AngularEvaporateUpload - file upload handler:
+ calculates name, url, content type for a new upload,
+ calculates progress percent, speed and estimated time,
+ saves status updates with timestamps,
+ saves info, warning and error messages,
+ binds Evaporate's API to the upload id,
+ updates $scope on Evaporate's callbacks,
+ manages dependent states (e.g. pausing, paused, resumed - only one can be true),
+ adds meta states (e.g. stopped is when either completed, canceled or failed).
AngularEvaporate - uploads queue handler (extends Evaporate):
+ manages uploads queue with an ability for every upload to be started later,
+ allows to specify a default config, which will be merged with every consequent upload's one,
+ allows to specify a custom naming function, where current instances of AngularEvaporateUpload and AngularEvaporate are available.
angular-evaporate - directive:
+ lazy mode option - explicit uploading start,
+ same files uploading option - clean file input after every select.
```javascript
yourApp.controller('yourCtrl', ['$scope', 'AngularEvaporate',
function ($scope, AngularEvaporate) {...}
]);
```
Init
```javascript
$scope.ae = new AngularEvaporate(...);
```
`AngularEvaporate` extends [`Evaporate`](https://github.com/TTLabs/EvaporateJS), so its constructor accepts the same arguments.
Follow the [Evaporate](https://github.com/TTLabs/EvaporateJS)'s instructions to set up an `S3` bucket, then accordingly update `AngularEvaporate`'s constructor parameters in the `example/index.js` file and `AWS_SECRET_KEY` value in the `example/server.js` file.
Run
```bash
npm install && npm start
```
Check
```
http://localhost:8080/example
```
Hint
Always use server-side validation for incoming requests to the signerUrl, because in this simple example anyone could send you anything he wanted and just get it signed with your secret key.
AngularEvaporate class
Extends Evaporate, therefore accepts the same constructor arguments and provides the same functionality, but also introduces additional features. To not interfere with possible future versions, all added object keys start from the $ symbol.
Properties
Property
Type
Usage
Description
$uploads
Array
essential
instances of AngularEvaporateUpload
$apply
Function
recommended
set this to your $scope.$apply.bind($scope) to update UI when needed
$config
Object
optional
default config for an upload (explicitly specified properties on a consequent call of $enqueue() or $add() will have higher priority)
$namer
Function
optional
custom upload naming function (instance of AngularEvaporateUpload as an input argument, instance of AngularEvaporate as this), default one just returns a filename
$speeder
Function
optional
custom speedometer function (input: current speed in bytes/second, output: string in readable format, like '1.23 MB/s')