https://github.com/gnucoop/ion-chunks-downloader
https://github.com/gnucoop/ion-chunks-downloader
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/gnucoop/ion-chunks-downloader
- Owner: gnucoop
- Created: 2018-10-19T09:10:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-19T10:27:16.000Z (over 7 years ago)
- Last Synced: 2024-12-26T15:44:30.899Z (over 1 year ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installation
1. Install cordova plugin:
```bash
ionic cordova plugin add https://github.com/gnucoop/cordova-plugin-chunks-downloader.git
```
2. Install bower module
```bash
bower install --save https://github.com/gnucoop/ion-chunks-downloader.git
```
3. Import the `ion-chunks-downloader` javascript.
```html
```
4. Add `ion-chunks-downloader` as a dependency on your Ionic app:
```javascript
angular.module("myApp", ["ionic", "ion-chunks-downloader"]);
```
# Usage
Inject the `$chunksDownloaderService` and call download method
```javascript
angular.module('myModule', ['ion-chunks-downloader'])
.run(function($chunksDownloaderService) {
var chunks = [
'https://example.com/chunk1',
'https://example.com/chunk2'
'https://example.com/chunk3'
];
var fileName = 'mergedFile.jpg';
$chunksDownloaderService
.download(chunks, fileName)
.then(function(mergedFileUri) {
// DO SOMETHING WITH MERGED FILE
})
.catch(console.log);
});
```