From 99c06472d18329eda1421286692bd875d76d5c9c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 28 Oct 2018 16:00:41 -0700 Subject: [PATCH] update readme with install instructions [skip ci] --- README.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dceb409..e34ad3c 100644 --- a/README.md +++ b/README.md @@ -27,20 +27,36 @@ It's also a good pairing with the attachment API in [PouchDB](http://pouchdb.com Install ------ -Via npm: +### Using Webpack/Rollup/Babel/TypeScript/etc. + +Install via npm: ```bash 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 import { canvasToBlob } from 'blob-util' 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 @@ -620,4 +636,4 @@ Or to test locally in your browser of choice: To build the API docs and insert them in the README: - npm run doc \ No newline at end of file + npm run doc