mirror of
https://github.com/nolanlawson/blob-util.git
synced 2025-12-08 19:46:19 +00:00
update readme with install instructions
[skip ci]
This commit is contained in:
parent
fbe16e845b
commit
99c06472d1
22
README.md
22
README.md
@ -27,20 +27,36 @@ It's also a good pairing with the attachment API in [PouchDB](http://pouchdb.com
|
|||||||
Install
|
Install
|
||||||
------
|
------
|
||||||
|
|
||||||
Via npm:
|
### Using Webpack/Rollup/Babel/TypeScript/etc.
|
||||||
|
|
||||||
|
Install via npm:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install blob-util
|
npm install blob-util
|
||||||
```
|
```
|
||||||
|
|
||||||
ES modules are supported:
|
ES module format:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import * as blobUtil from 'blob-util'
|
||||||
|
blobUtil.canvasToBlob(canvas, 'image/png').then(/* ... */)
|
||||||
|
```
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { canvasToBlob } from 'blob-util'
|
import { canvasToBlob } from 'blob-util'
|
||||||
canvasToBlob(canvas, 'image/png').then(/* ... */)
|
canvasToBlob(canvas, 'image/png').then(/* ... */)
|
||||||
```
|
```
|
||||||
|
|
||||||
Or as a script tag:
|
CommonJS format:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var blobUtil = require('blob-util')
|
||||||
|
blobUtil.canvasToBlob(canvas, 'image/png').then(/* ... */)
|
||||||
|
```
|
||||||
|
|
||||||
|
### As a script tag
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://unpkg.com/blob-util/dist/blob-util.min.js"></script>
|
<script src="https://unpkg.com/blob-util/dist/blob-util.min.js"></script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user