0.0.2 • Published 7 years ago

angular-base64-download v0.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

angular-base64-download

Simple implementation of base64 download files for angularjs applications

Installation

Bower

$ bower install angular-base64-download

Embed it in your HTML:

<script src="./bower_components/angular-base64-download/base64-download.js"></script>

NPM

$ npm install angular-base64-download

Embed it in your HTML:

<script src="./node_modules/angular-base64-download/base64-download.js"></script>

Dependency injection

Inject angular-base64-download module as a dependency into your app:

var app = angular.module('app', [
  'ngBase64Download'
])

Usage

Example of minimum usage:

In controller:

angular.controller('myCtrl',['base64DownloadFactory',function(base64DownloadFactory){
  base64DownloadFactory.download('data:text/plain;base64,aGVsbG8=', 'MyFileHello', 'txt')
}]);

Will download a file called "MyFileHello.txt" with content "hello".

That's all.

See ./demos for interactive usage example.

Tests

To run the package's test, first install the dependencies, then run npm test:

$ npm install --only=dev
$ bower install

or

$ npm install

License

MIT License