Skip to content

Commit a5e570c

Browse files
author
Philipp Alferov
committed
Update readme
1 parent 861a305 commit a5e570c

File tree

2 files changed

+79
-26
lines changed

2 files changed

+79
-26
lines changed

docs/index.html

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,33 @@ <h2 class="project-tagline">An AngularJS service that provides cross-browser com
2222
<section class="main-content">
2323

2424
<!-- inject:html -->
25-
<h1 id="angular-file-saver-build-status-https-travis-ci-org-alferov-angular-file-saver-svg-https-travis-ci-org-alferov-angular-file-saver-">Angular File Saver <a href="https://travis-ci.org/alferov/angular-file-saver"><img src="https://travis-ci.org/alferov/angular-file-saver.svg" alt="Build Status"></a></h1>
25+
<h1 id="angular-file-saver">Angular File Saver</h1>
26+
<p><a href="https://npmjs.org/package/angular-file-saver"><img src="https://img.shields.io/npm/v/angular-file-saver.svg?style=flat-square" alt="NPM version"></a>
27+
<a href="https://travis-ci.org/alferov/angular-file-saver"><img src="https://img.shields.io/travis/alferov/angular-file-saver.svg?style=flat-square" alt="Build Status"></a>
28+
<a href="https://david-dm.org/alferov/angular-file-saver"><img src="https://david-dm.org/alferov/angular-file-saver.svg?style=flat-square" alt="Dependency Status"></a></p>
2629
<blockquote>
2730
<p>Angular File Saver is an AngularJS service that leverages
2831
<a href="https://github.com/eligrey/FileSaver.js/">FileSaver.js</a> and
2932
<a href="https://github.com/eligrey/Blob.js/">Blob.js</a> to implement the HTML5 W3C
30-
saveAs() interface in browsers that do not natively support it.</p>
33+
saveAs() interface in browsers that do not natively support it</p>
3134
</blockquote>
3235
<h2 id="dependencies">Dependencies</h2>
3336
<ul>
34-
<li><a href="https://github.com/angular/angular.js">AngularJS</a></li>
37+
<li><a href="https://github.com/angular/angular.js">Angular</a></li>
3538
<li><a href="https://github.com/eligrey/FileSaver.js/">FileSaver.js</a></li>
3639
<li><a href="https://github.com/eligrey/Blob.js/">Blob.js</a></li>
3740
</ul>
3841
<p>File <code>dist/angular-file-saver.bundle.js</code> contains all required dependencies and
3942
grants access to both <code>Blob.js</code> and <code>FileSaver.js</code> polyfills via <code>Blob</code> and
4043
<code>SaveAs</code> services.</p>
4144
<h2 id="installation">Installation</h2>
42-
<p>Using bower:</p>
43-
<pre><code>$ bower install angular-file-saver
44-
</code></pre><p>Using npm:</p>
45-
<pre><code>$ npm install angular-file-saver
46-
</code></pre><h2 id="basic-usage">Basic usage</h2>
45+
<pre><code class="lang-sh"># Using bower:
46+
$ bower install angular-file-saver
47+
48+
# Using npm:
49+
$ npm install angular-file-saver
50+
</code></pre>
51+
<h2 id="basic-usage">Basic usage</h2>
4752
<ul>
4853
<li>Include the <code>ngFileSaver</code> module into your project;</li>
4954
<li>Pass both <code>FileSaver</code> and <code>Blob</code> services as dependencies;</li>
@@ -57,9 +62,26 @@ <h2 id="installation">Installation</h2>
5762
</ul>
5863
</li>
5964
</ul>
65+
<p><a href="http://alferov.github.io/angular-file-saver/#demo">Demo</a></p>
66+
<h2 id="api">API</h2>
67+
<h3 id="-filesaver-"><code>FileSaver</code></h3>
68+
<h4 id="-saveas-data-filename-disableautobom-"><code>#saveAs(data, filename[, disableAutoBOM])</code></h4>
69+
<p>Immediately starts saving a file</p>
70+
<h4 id="parameters">Parameters</h4>
71+
<ul>
72+
<li><strong>Blob</strong> <code>data</code>: a Blob instance;</li>
73+
<li><strong>String</strong> <code>filename</code>: Custom filename (extension is optional);</li>
74+
<li><strong>Boolean</strong> <code>disableAutoBOM</code> : (optional) Disable automatically provided Unicode text encoding hints;</li>
75+
</ul>
76+
<h3 id="-blob-blobparts-options-"><code>Blob(blobParts[, options]))</code></h3>
77+
<p>An Angular factory that returns a Blob instance.
78+
<a href="https://developer.mozilla.org/en/docs/Web/API/Blob">Blob API on MDN</a></p>
79+
<h3 id="-saveas-data-filename-disableautobom-"><code>SaveAs(data, filename[, disableAutoBOM])</code></h3>
80+
<p>An Angular factory that returns a FileSaver.js <code>saveAs</code> polyfill.
81+
<a href="https://github.com/eligrey/FileSaver.js/#syntax">FileSaver.js documentationruvy</a></p>
6082
<h2 id="example">Example</h2>
6183
<p><strong>JS</strong></p>
62-
<pre><code class="lang-js">function ExampleCtrl($timeout, FileSaver, Blob) {
84+
<pre><code class="lang-js">function ExampleCtrl(FileSaver, Blob) {
6385
var vm = this;
6486

6587
vm.val = {
@@ -68,7 +90,7 @@ <h2 id="example">Example</h2>
6890

6991
vm.download = function(text) {
7092
var data = new Blob([text], { type: &#39;text/plain;charset=utf-8&#39; });
71-
$timeout(FileSaver.saveAs.bind(FileSaver, data, &#39;text.txt&#39;), 100);
93+
FileSaver.saveAs(data, &#39;text.txt&#39;);
7294
};
7395
}
7496

@@ -80,7 +102,6 @@ <h2 id="example">Example</h2>
80102
<pre><code class="lang-html">&lt;div class=&quot;wrapper&quot; ng-controller=&quot;ExampleCtrl as vm&quot;&gt;
81103
&lt;textarea
82104
ng-model=&quot;vm.val.text&quot;
83-
ng-model-options=&quot;{ getterSetter: true }&quot;
84105
name=&quot;textarea&quot; rows=&quot;5&quot; cols=&quot;20&quot;&gt;
85106
Hey ho let&#39;s go!
86107
&lt;/textarea&gt;
@@ -89,8 +110,8 @@ <h2 id="example">Example</h2>
89110
&lt;/a&gt;
90111
&lt;/div&gt;
91112
</code></pre>
92-
<h2 id="demo">Demo</h2>
93-
<p><a href="http://alferov.github.io/angular-file-saver/#demo">Demo on <code>gh-pages</code></a></p>
113+
<h2 id="license">License</h2>
114+
<p>MIT © <a href="https://github.com/alferov">Philipp Alferov</a></p>
94115

95116
<!-- endinject -->
96117

readme.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
Angular File Saver [![Build Status](https://travis-ci.org/alferov/angular-file-saver.svg)](https://travis-ci.org/alferov/angular-file-saver)
2-
=========
1+
# Angular File Saver
2+
3+
[![NPM version][npm-image]][npm-url]
4+
[![Build Status][travis-image]][travis-url]
5+
[![Dependency Status][depstat-image]][depstat-url]
36

47
> Angular File Saver is an AngularJS service that leverages
58
[FileSaver.js](https://github.com/eligrey/FileSaver.js/) and
69
[Blob.js](https://github.com/eligrey/Blob.js/) to implement the HTML5 W3C
7-
saveAs() interface in browsers that do not natively support it.
10+
saveAs() interface in browsers that do not natively support it
811

912
## Dependencies
10-
- [AngularJS](https://github.com/angular/angular.js)
13+
- [Angular](https://github.com/angular/angular.js)
1114
- [FileSaver.js](https://github.com/eligrey/FileSaver.js/)
1215
- [Blob.js](https://github.com/eligrey/Blob.js/)
1316

@@ -16,12 +19,12 @@ grants access to both `Blob.js` and `FileSaver.js` polyfills via `Blob` and
1619
`SaveAs` services.
1720

1821
## Installation
19-
Using bower:
20-
```
22+
23+
```sh
24+
# Using bower:
2125
$ bower install angular-file-saver
22-
```
23-
Using npm:
24-
```
26+
27+
# Using npm:
2528
$ npm install angular-file-saver
2629
```
2730

@@ -36,10 +39,30 @@ as the second one: `new Blob(['text'], { type: 'text/plain;charset=utf-8' })`;
3639
- `filename` **String**: Custom filename (extension is optional);
3740
- `disableAutoBOM` **Boolean**: (optional) Disable automatically provided Unicode text encoding hints;
3841

42+
[Demo](http://alferov.github.io/angular-file-saver/#demo)
43+
44+
## API
45+
### `FileSaver`
46+
#### `#saveAs(data, filename[, disableAutoBOM])`
47+
Immediately starts saving a file
48+
49+
#### Parameters
50+
- **Blob** `data`: a Blob instance;
51+
- **String** `filename`: Custom filename (extension is optional);
52+
- **Boolean** `disableAutoBOM` : (optional) Disable automatically provided Unicode text encoding hints;
53+
54+
### `Blob(blobParts[, options]))`
55+
An Angular factory that returns a Blob instance.
56+
[Blob API on MDN](https://developer.mozilla.org/en/docs/Web/API/Blob)
57+
58+
### `SaveAs(data, filename[, disableAutoBOM])`
59+
An Angular factory that returns a FileSaver.js `saveAs` polyfill.
60+
[FileSaver.js documentationruvy](https://github.com/eligrey/FileSaver.js/#syntax)
61+
3962
## Example
4063
**JS**
4164
```js
42-
function ExampleCtrl($timeout, FileSaver, Blob) {
65+
function ExampleCtrl(FileSaver, Blob) {
4366
var vm = this;
4467

4568
vm.val = {
@@ -62,7 +85,6 @@ angular
6285
<div class="wrapper" ng-controller="ExampleCtrl as vm">
6386
<textarea
6487
ng-model="vm.val.text"
65-
ng-model-options="{ getterSetter: true }"
6688
name="textarea" rows="5" cols="20">
6789
Hey ho let's go!
6890
</textarea>
@@ -71,5 +93,15 @@ angular
7193
</a>
7294
</div>
7395
```
74-
## Demo
75-
[Demo on `gh-pages`](http://alferov.github.io/angular-file-saver/#demo)
96+
97+
## License
98+
MIT © [Philipp Alferov](https://github.com/alferov)
99+
100+
[npm-url]: https://npmjs.org/package/angular-file-saver
101+
[npm-image]: https://img.shields.io/npm/v/angular-file-saver.svg?style=flat-square
102+
103+
[travis-url]: https://travis-ci.org/alferov/angular-file-saver
104+
[travis-image]: https://img.shields.io/travis/alferov/angular-file-saver.svg?style=flat-square
105+
106+
[depstat-url]: https://david-dm.org/alferov/angular-file-saver
107+
[depstat-image]: https://david-dm.org/alferov/angular-file-saver.svg?style=flat-square

0 commit comments

Comments
 (0)