Simple implementation of base64 download files for angularjs applications
$ bower install angular-base64-download
Embed it in your HTML:
<script src="./bower_components/angular-base64-download/base64-download.js"></script>
$ npm install angular-base64-download
Embed it in your HTML:
<script src="./node_modules/angular-base64-download/base64-download.js"></script>
Inject angular-base64-download
module as a dependency into your app:
var app = angular.module('app', [
'ngBase64Download'
])
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.
To run the package's test, first install the dependencies, then run npm test
:
$ npm install --only=dev
$ bower install
or
$ npm install
MIT License