fixup and update docs
2
.gitignore
vendored
@ -6,5 +6,3 @@ test/test-bundle.js
|
||||
npm-debug.log
|
||||
dist
|
||||
api.md
|
||||
doc/global.html
|
||||
doc/index.html
|
||||
|
||||
27
README.md
@ -118,6 +118,7 @@ Warning: this API uses [Promises](https://promisesaplus.com/), because it's not
|
||||
* [binaryStringToBlob(binary, type)](#binaryStringToBlob)
|
||||
* [blobToBase64String(blob)](#blobToBase64String)
|
||||
* [dataURLToBlob(dataURL)](#dataURLToBlob)
|
||||
* [blobToDataURL(blob)](#blobToDataURL)
|
||||
* [imgSrcToDataURL(src, type, crossOrigin, quality)](#imgSrcToDataURL)
|
||||
* [canvasToBlob(canvas, type, quality)](#canvasToBlob)
|
||||
* [imgSrcToBlob(src, type, crossOrigin, quality)](#imgSrcToBlob)
|
||||
@ -284,7 +285,27 @@ blobUtil.dataURLToBlob(dataURL).then(function (blob) {
|
||||
// error
|
||||
});
|
||||
```
|
||||
<a name="blobToDataURL"></a>
|
||||
###blobToDataURL(blob)
|
||||
Convert a <code>Blob</code> to a data URL string
|
||||
(e.g. <code>'data:image/png;base64,iVBORw0KG...'</code>).
|
||||
Returns a Promise.
|
||||
|
||||
**Params**
|
||||
|
||||
- blob `Blob`
|
||||
|
||||
**Returns**: `Promise` - Promise that resolves with the data URL string
|
||||
|
||||
**Example**:
|
||||
|
||||
```js
|
||||
blobUtil.blobToDataURL(blob).then(function (dataURL) {
|
||||
// success
|
||||
}).catch(function (err) {
|
||||
// error
|
||||
});
|
||||
```
|
||||
<a name="imgSrcToDataURL"></a>
|
||||
### imgSrcToDataURL(src, type, crossOrigin, quality)
|
||||
Convert an image's <code>src</code> URL to a data URL by loading the image and painting
|
||||
@ -460,10 +481,8 @@ The playground is just `jsdoc` with some extra text containing Kirby and the cod
|
||||
|
||||
So unfortunately you will need to do a manual diff to get the docs up to date. You'll need to diff:
|
||||
|
||||
* `api.md` to `README.md`
|
||||
* `index.html` to `doc/global.html`
|
||||
|
||||
Update: I also manually added a bunch of code samples to `README.md` because jsdoc didn't seem to support that. So... yeah, jsdoc might not be so helpful anymore.
|
||||
* `README.md` to its previous version (make sure to keep the code samples, which were manually added)
|
||||
* `docs` to its previous version
|
||||
|
||||
Testing the library
|
||||
----
|
||||
|
||||
|
Before Width: | Height: | Size: 378 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 117 KiB |
@ -4,49 +4,27 @@
|
||||
<meta charset="utf-8">
|
||||
<title>Playground for blob-util</title>
|
||||
|
||||
<script src="doc/scripts/prettify/prettify.js"> </script>
|
||||
<script src="doc/scripts/prettify/lang-css.js"> </script>
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="doc/styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="doc/styles/jsdoc-default.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">blob-util</h1>
|
||||
|
||||
|
||||
<h1 class="page-title">Playground for blob-util</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
|
||||
<h2>
|
||||
|
||||
</h2>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
|
||||
|
||||
<h1 class="page-title">Playground for blob-util</h1>
|
||||
|
||||
|
||||
<p>Welcome to the docs and playground for <a href="https://github.com/nolanlawson/blob-util"><code>blob-util</code></a>!</p>
|
||||
<p>Below you'll find API documentation, as well as a little Kirby GIF you can play around with.</p>
|
||||
<p><img id="kirby" alt="Kirby" src="test/kirby.gif"/></p>
|
||||
<p>Here's some code to get you started. Copy-paste this into your console:</p>
|
||||
<pre class="prettyprint source" style="border-left: 3px solid #A35A00; margin-left: 20px; max-width: 700px;">
|
||||
<p>Welcome to the docs and playground for <a href="https://github.com/nolanlawson/blob-util"><code>blob-util</code></a>!</p>
|
||||
<p>Below you'll find API documentation, as well as a little Kirby GIF you can play around with.</p>
|
||||
<p><img id="kirby" alt="Kirby" src="kirby.gif"/></p>
|
||||
<p>Here's some code to get you started. Copy-paste this into your console:</p>
|
||||
<pre class="prettyprint source" style="border-left: 3px solid #A35A00; margin-left: 20px; max-width: 700px;">
|
||||
<code>
|
||||
var img = document.getElementById('kirby');
|
||||
|
||||
@ -59,7 +37,26 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
img.parentNode.appendChild(newImg);
|
||||
});</code>
|
||||
</pre>
|
||||
<p>If you see two Kirbys, you're on your way!</p>
|
||||
<p>If you see two Kirbys, you're on your way!</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
|
||||
<h2></h2>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
@ -108,7 +105,9 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -122,7 +121,9 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="arrayBufferToBlob"><span class="type-signature"></span>arrayBufferToBlob<span class="signature">(buffer, type)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -248,7 +249,7 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line272">line 272</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line285">line 285</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -296,12 +297,16 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="base64StringToBlob"><span class="type-signature"></span>base64StringToBlob<span class="signature">(base64, type)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -427,7 +432,7 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line149">line 149</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line149">line 149</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -475,12 +480,16 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="binaryStringToBlob"><span class="type-signature"></span>binaryStringToBlob<span class="signature">(binary, type)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -606,7 +615,7 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line162">line 162</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line162">line 162</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -654,12 +663,16 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="blobToArrayBuffer"><span class="type-signature"></span>blobToArrayBuffer<span class="signature">(blob)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -759,7 +772,7 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line283">line 283</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line296">line 296</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -807,12 +820,16 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="blobToBase64String"><span class="type-signature"></span>blobToBase64String<span class="signature">(blob)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -912,7 +929,7 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line173">line 173</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line173">line 173</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -960,12 +977,16 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="blobToBinaryString"><span class="type-signature"></span>blobToBinaryString<span class="signature">(blob)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1065,7 +1086,7 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line123">line 123</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line123">line 123</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1113,12 +1134,175 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="blobToDataURL"><span class="type-signature"></span>blobToDataURL<span class="signature">(blob)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="description">
|
||||
Convert a <code>Blob</code> to a data URL string
|
||||
(e.g. <code>'data:image/png;base64,iVBORw0KG...'</code>).
|
||||
Returns a Promise.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>blob</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Blob</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line203">line 203</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
Promise that resolves with the data URL string
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">Promise</span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="canvasToBlob"><span class="type-signature"></span>canvasToBlob<span class="signature">(canvas, type, quality)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1271,7 +1455,7 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line229">line 229</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line242">line 242</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1319,12 +1503,16 @@ blobUtil.imgSrcToBlob(img.src).then(function (blob) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="createBlob"><span class="type-signature"></span>createBlob<span class="signature">(parts, options)</span><span class="type-signature"> → {Blob}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1450,7 +1638,7 @@ to support
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line86">line 86</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line86">line 86</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1494,12 +1682,16 @@ to support
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="createObjectURL"><span class="type-signature"></span>createObjectURL<span class="signature">(blob)</span><span class="type-signature"> → {string}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1602,7 +1794,7 @@ to support browsers that only have the prefixed
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line102">line 102</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line102">line 102</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1650,12 +1842,16 @@ to support browsers that only have the prefixed
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="dataURLToBlob"><span class="type-signature"></span>dataURLToBlob<span class="signature">(dataURL)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1757,7 +1953,7 @@ to a <code>Blob</code>. Returns a Promise.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line186">line 186</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line186">line 186</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1805,12 +2001,16 @@ to a <code>Blob</code>. Returns a Promise.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="imgSrcToBlob"><span class="type-signature"></span>imgSrcToBlob<span class="signature">(src, type, crossOrigin, quality)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1994,7 +2194,7 @@ will only paint the first frame of an animated GIF.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line255">line 255</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line268">line 268</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -2042,12 +2242,16 @@ will only paint the first frame of an animated GIF.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="imgSrcToDataURL"><span class="type-signature"></span>imgSrcToDataURL<span class="signature">(src, type, crossOrigin, quality)</span><span class="type-signature"> → {Promise}</span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2231,7 +2435,7 @@ will only paint the first frame of an animated GIF.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line211">line 211</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line224">line 224</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -2279,12 +2483,16 @@ will only paint the first frame of an animated GIF.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="revokeObjectURL"><span class="type-signature"></span>revokeObjectURL<span class="signature">(url)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2387,7 +2595,7 @@ to support browsers that only have the prefixed
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="doc/index.js.html">index.js</a>, <a href="doc/index.js.html#line113">line 113</a>
|
||||
<a href="index.js.html">index.js</a>, <a href="index.js.html#line113">line 113</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -2413,6 +2621,8 @@ to support browsers that only have the prefixed
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2429,17 +2639,17 @@ to support browsers that only have the prefixed
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Home</a></h2><h3>blob-util</h3><ul><li><a href="#arrayBufferToBlob">arrayBufferToBlob</a></li><li><a href="#base64StringToBlob">base64StringToBlob</a></li><li><a href="#binaryStringToBlob">binaryStringToBlob</a></li><li><a href="#blobToArrayBuffer">blobToArrayBuffer</a></li><li><a href="#blobToBase64String">blobToBase64String</a></li><li><a href="#blobToBinaryString">blobToBinaryString</a></li><li><a href="#canvasToBlob">canvasToBlob</a></li><li><a href="#createBlob">createBlob</a></li><li><a href="#createObjectURL">createObjectURL</a></li><li><a href="#dataURLToBlob">dataURLToBlob</a></li><li><a href="#imgSrcToBlob">imgSrcToBlob</a></li><li><a href="#imgSrcToDataURL">imgSrcToDataURL</a></li><li><a href="#revokeObjectURL">revokeObjectURL</a></li></ul>
|
||||
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="index.html#arrayBufferToBlob">arrayBufferToBlob</a></li><li><a href="index.html#base64StringToBlob">base64StringToBlob</a></li><li><a href="index.html#binaryStringToBlob">binaryStringToBlob</a></li><li><a href="index.html#blobToArrayBuffer">blobToArrayBuffer</a></li><li><a href="index.html#blobToBase64String">blobToBase64String</a></li><li><a href="index.html#blobToBinaryString">blobToBinaryString</a></li><li><a href="index.html#blobToDataURL">blobToDataURL</a></li><li><a href="index.html#canvasToBlob">canvasToBlob</a></li><li><a href="index.html#createBlob">createBlob</a></li><li><a href="index.html#createObjectURL">createObjectURL</a></li><li><a href="index.html#dataURLToBlob">dataURLToBlob</a></li><li><a href="index.html#imgSrcToBlob">imgSrcToBlob</a></li><li><a href="index.html#imgSrcToDataURL">imgSrcToDataURL</a></li><li><a href="index.html#revokeObjectURL">revokeObjectURL</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta3</a> on Sat Jan 16 2016 14:43:19 GMT-0500 (EST)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Tue Aug 08 2017 13:21:18 GMT-0700 (PDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="doc/scripts/linenumber.js"> </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
<script src="https://unpkg.com/blob-util/dist/blob-util.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
/* jshint -W079 */
|
||||
var Blob = require('blob');
|
||||
var Promise = require('pouchdb-promise');
|
||||
var Promise = require('native-or-lie');
|
||||
|
||||
//
|
||||
// PRIVATE
|
||||
@ -221,6 +221,19 @@ function dataURLToBlob(dataURL) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a <code>Blob</code> to a data URL string
|
||||
* (e.g. <code>'data:image/png;base64,iVBORw0KG...'</code>).
|
||||
* Returns a Promise.
|
||||
* @param {Blob} blob
|
||||
* @returns {Promise} Promise that resolves with the data URL string
|
||||
*/
|
||||
function blobToDataURL(blob) {
|
||||
return blobToBase64String(blob).then(function (base64String) {
|
||||
return 'data:' + blob.type + ';base64,' + base64String;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an image's <code>src</code> URL to a data URL by loading the image and painting
|
||||
* it to a <code>canvas</code>. Returns a Promise.
|
||||
@ -328,6 +341,7 @@ module.exports = {
|
||||
imgSrcToDataURL : imgSrcToDataURL,
|
||||
canvasToBlob : canvasToBlob,
|
||||
dataURLToBlob : dataURLToBlob,
|
||||
blobToDataURL : blobToDataURL,
|
||||
blobToBase64String : blobToBase64String,
|
||||
base64StringToBlob : base64StringToBlob,
|
||||
binaryStringToBlob : binaryStringToBlob,
|
||||
@ -345,13 +359,13 @@ module.exports = {
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#arrayBufferToBlob">arrayBufferToBlob</a></li><li><a href="global.html#base64StringToBlob">base64StringToBlob</a></li><li><a href="global.html#binaryStringToBlob">binaryStringToBlob</a></li><li><a href="global.html#blobToArrayBuffer">blobToArrayBuffer</a></li><li><a href="global.html#blobToBase64String">blobToBase64String</a></li><li><a href="global.html#blobToBinaryString">blobToBinaryString</a></li><li><a href="global.html#canvasToBlob">canvasToBlob</a></li><li><a href="global.html#createBlob">createBlob</a></li><li><a href="global.html#createObjectURL">createObjectURL</a></li><li><a href="global.html#dataURLToBlob">dataURLToBlob</a></li><li><a href="global.html#imgSrcToBlob">imgSrcToBlob</a></li><li><a href="global.html#imgSrcToDataURL">imgSrcToDataURL</a></li><li><a href="global.html#revokeObjectURL">revokeObjectURL</a></li></ul>
|
||||
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="index.html#arrayBufferToBlob">arrayBufferToBlob</a></li><li><a href="index.html#base64StringToBlob">base64StringToBlob</a></li><li><a href="index.html#binaryStringToBlob">binaryStringToBlob</a></li><li><a href="index.html#blobToArrayBuffer">blobToArrayBuffer</a></li><li><a href="index.html#blobToBase64String">blobToBase64String</a></li><li><a href="index.html#blobToBinaryString">blobToBinaryString</a></li><li><a href="index.html#blobToDataURL">blobToDataURL</a></li><li><a href="index.html#canvasToBlob">canvasToBlob</a></li><li><a href="index.html#createBlob">createBlob</a></li><li><a href="index.html#createObjectURL">createObjectURL</a></li><li><a href="index.html#dataURLToBlob">dataURLToBlob</a></li><li><a href="index.html#imgSrcToBlob">imgSrcToBlob</a></li><li><a href="index.html#imgSrcToDataURL">imgSrcToDataURL</a></li><li><a href="index.html#revokeObjectURL">revokeObjectURL</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta3</a> on Sat Jan 16 2016 14:43:19 GMT-0500 (EST)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Tue Aug 08 2017 13:21:18 GMT-0700 (PDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
BIN
docs/kirby.gif
Normal file
|
After Width: | Height: | Size: 263 B |
@ -78,6 +78,10 @@ article dl {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
article img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
section
|
||||
{
|
||||
display: block;
|
||||
@ -153,7 +157,7 @@ h1
|
||||
margin: 12px 24px 20px;
|
||||
}
|
||||
|
||||
h2, h3
|
||||
h2, h3.subsection-title
|
||||
{
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
@ -161,6 +165,13 @@ h2, h3
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
h3
|
||||
{
|
||||
font-size: 24px;
|
||||
letter-spacing: -0.5px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
h4
|
||||
{
|
||||
font-size: 18px;
|
||||
@ -185,8 +196,34 @@ h6
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.ancestors { color: #999; }
|
||||
.ancestors a
|
||||
table
|
||||
{
|
||||
border-spacing: 0;
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
td, th
|
||||
{
|
||||
border: 1px solid #ddd;
|
||||
margin: 0px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
padding: 4px 6px;
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
thead tr
|
||||
{
|
||||
background-color: #ddd;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
th { border-right: 1px solid #aaa; }
|
||||
tr > th:last-child { border-right: 1px solid #ddd; }
|
||||
|
||||
.ancestors, .attribs { color: #999; }
|
||||
.ancestors a, .attribs a
|
||||
{
|
||||
color: #999 !important;
|
||||
text-decoration: none;
|
||||
@ -296,44 +333,12 @@ h6
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.params, .props
|
||||
{
|
||||
border-spacing: 0;
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.params .name, .props .name, .name code {
|
||||
color: #4D4E53;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.params td, .params th, .props td, .props th
|
||||
{
|
||||
border: 1px solid #ddd;
|
||||
margin: 0px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
padding: 4px 6px;
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
.params thead tr, .props thead tr
|
||||
{
|
||||
background-color: #ddd;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.params .params thead tr, .props .props thead tr
|
||||
{
|
||||
background-color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.params th, .props th { border-right: 1px solid #aaa; }
|
||||
.params thead .last, .props thead .last { border-right: 1px solid #ddd; }
|
||||
|
||||
.params td.description > p:first-child,
|
||||
.props td.description > p:first-child
|
||||
{
|
||||
@ -26,8 +26,8 @@
|
||||
"build": "mkdirp dist && npm run browserify && npm run min",
|
||||
"browserify": "browserify . -p bundle-collapser/plugin -s blobUtil | ./bin/es3ify.js | derequire > dist/blob-util.js",
|
||||
"min": "uglifyjs dist/blob-util.js -mc > dist/blob-util.min.js",
|
||||
"jsdoc2md": "jsdoc2md --heading-depth 3 ./lib/index.js > api.md",
|
||||
"jsdoc": "jsdoc -d doc ./lib/index.js"
|
||||
"jsdoc2md": "jsdoc2md --heading-depth 3 ./lib/index.js > README.md",
|
||||
"jsdoc": "jsdoc -d docs ./lib/index.js && mv -f docs/global.html docs/index.html"
|
||||
},
|
||||
"dependencies": {
|
||||
"blob": "0.0.4",
|
||||
|
||||