Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Alferov committed Feb 24, 2016
1 parent dd2ca7b commit a146af8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
17 changes: 8 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,35 +50,34 @@ <h2 id="installation">Installation</h2>
</code></pre>
<h2 id="basic-usage">Basic usage</h2>
<ul>
<li>Include the <code>ngFileSaver</code> module into your project;</li>
<li>Include <code>ngFileSaver</code> module into your project;</li>
<li>Pass both <code>FileSaver</code> and <code>Blob</code> services as dependencies;</li>
<li>Create a <a href="https://developer.mozilla.org/en/docs/Web/API/Blob">Blob object</a>
passing an array with data as a first argument and an object with set of options
<li>Create a <a href="https://developer.mozilla.org/en/docs/Web/API/Blob">Blob object</a> by
passing an array with data as the first argument and an object with set of options
as the second one: <code>new Blob([&#39;text&#39;], { type: &#39;text/plain;charset=utf-8&#39; })</code>;</li>
<li>Invoke <code>FileSaver.saveAs</code> with the following arguments:<ul>
<li><code>data</code> <strong>Blob</strong>: a Blob instance;</li>
<li><code>filename</code> <strong>String</strong>: Custom filename (extension is optional);</li>
<li><code>filename</code> <strong>String</strong>: a custom filename (an extension is optional);</li>
<li><code>disableAutoBOM</code> <strong>Boolean</strong>: (optional) Disable automatically provided Unicode text encoding hints;</li>
</ul>
</li>
</ul>
<p><a href="http://alferov.github.io/angular-file-saver/#demo">Demo</a></p>
<h2 id="api">API</h2>
<h3 id="-filesaver-"><code>FileSaver</code></h3>
<p>A core Angular factory.</p>
<h4 id="-saveas-data-filename-disableautobom-"><code>#saveAs(data, filename[, disableAutoBOM])</code></h4>
<p>Immediately starts saving a file</p>
<h4 id="parameters">Parameters</h4>
<ul>
<li><strong>Blob</strong> <code>data</code>: a Blob instance;</li>
<li><strong>String</strong> <code>filename</code>: Custom filename (extension is optional);</li>
<li><strong>String</strong> <code>filename</code>: a custom filename (an extension is optional);</li>
<li><strong>Boolean</strong> <code>disableAutoBOM</code> : (optional) Disable automatically provided Unicode text encoding hints;</li>
</ul>
<h3 id="-blob-blobparts-options-"><code>Blob(blobParts[, options]))</code></h3>
<p>An Angular factory that returns a Blob instance.
<a href="https://developer.mozilla.org/en/docs/Web/API/Blob">Blob API on MDN</a></p>
<p>An Angular factory that returns a <a href="https://developer.mozilla.org/en/docs/Web/API/Blob">Blob instance</a>.</p>
<h3 id="-saveas-data-filename-disableautobom-"><code>SaveAs(data, filename[, disableAutoBOM])</code></h3>
<p>An Angular factory that returns a FileSaver.js <code>saveAs</code> polyfill.
<a href="https://github.com/eligrey/FileSaver.js/#syntax">FileSaver.js documentationruvy</a></p>
<p>An Angular factory that returns a <a href="https://github.com/eligrey/FileSaver.js/#syntax">FileSaver.js polyfill</a>.</p>
<h2 id="example">Example</h2>
<p><strong>JS</strong></p>
<pre><code class="lang-js">function ExampleCtrl(FileSaver, Blob) {
Expand Down
17 changes: 8 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,34 @@ $ npm install angular-file-saver
```

## Basic usage
- Include the `ngFileSaver` module into your project;
- Include `ngFileSaver` module into your project;
- Pass both `FileSaver` and `Blob` services as dependencies;
- Create a [Blob object](https://developer.mozilla.org/en/docs/Web/API/Blob)
passing an array with data as a first argument and an object with set of options
- Create a [Blob object](https://developer.mozilla.org/en/docs/Web/API/Blob) by
passing an array with data as the first argument and an object with set of options
as the second one: `new Blob(['text'], { type: 'text/plain;charset=utf-8' })`;
- Invoke `FileSaver.saveAs` with the following arguments:
- `data` **Blob**: a Blob instance;
- `filename` **String**: Custom filename (extension is optional);
- `filename` **String**: a custom filename (an extension is optional);
- `disableAutoBOM` **Boolean**: (optional) Disable automatically provided Unicode text encoding hints;

[Demo](http://alferov.github.io/angular-file-saver/#demo)

## API
### `FileSaver`
A core Angular factory.
#### `#saveAs(data, filename[, disableAutoBOM])`
Immediately starts saving a file

#### Parameters
- **Blob** `data`: a Blob instance;
- **String** `filename`: Custom filename (extension is optional);
- **String** `filename`: a custom filename (an extension is optional);
- **Boolean** `disableAutoBOM` : (optional) Disable automatically provided Unicode text encoding hints;

### `Blob(blobParts[, options]))`
An Angular factory that returns a Blob instance.
[Blob API on MDN](https://developer.mozilla.org/en/docs/Web/API/Blob)
An Angular factory that returns a [Blob instance](https://developer.mozilla.org/en/docs/Web/API/Blob).

### `SaveAs(data, filename[, disableAutoBOM])`
An Angular factory that returns a FileSaver.js `saveAs` polyfill.
[FileSaver.js documentation](https://github.com/eligrey/FileSaver.js/#syntax)
An Angular factory that returns a [FileSaver.js polyfill](https://github.com/eligrey/FileSaver.js/#syntax).

## Example
**JS**
Expand Down

0 comments on commit a146af8

Please sign in to comment.