diff --git a/README.md b/README.md index 7208db1..dceb409 100644 --- a/README.md +++ b/README.md @@ -288,7 +288,7 @@ blobUtil.blobToArrayBuffer(blob).then(function (arrayBuff) { | blob | `Blob` | - | **Returns:** `Promise`<`ArrayBuffer`> -Promise that resolves with the ArrayBuffer +Promise that resolves with the `ArrayBuffer` ___ @@ -408,7 +408,7 @@ blobUtil.canvasToBlob(canvas, 'image/webp').then(function (blob) { | `Optional` quality | `number` | a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp' | **Returns:** `Promise`<`Blob`> -Promise that resolves with the Blob +Promise that resolves with the `Blob` ___ @@ -417,7 +417,7 @@ ___ ▸ **createBlob**(parts: *`Array`<`any`>*, properties?: * `BlobPropertyBag` | `string`*): `Blob` -Shim for [`new Blob()`](https://developer.mozilla.org/en-US/docs/Web/API/Blob.Blob ) to support [older browsers that use the deprecated `BlobBuilder` API](http://caniuse.com/blob ). +Shim for [`new Blob()`](https://developer.mozilla.org/en-US/docs/Web/API/Blob.Blob) to support [older browsers that use the deprecated `BlobBuilder` API](http://caniuse.com/blob). Example: @@ -429,8 +429,8 @@ var myBlob = blobUtil.createBlob(['hello world'], {type: 'text/plain'}); | Param | Type | Description | | ------ | ------ | ------ | -| parts | `Array`<`any`> | content of the Blob | -| `Optional` properties | `BlobPropertyBag` | `string`| usually {type: myContentType}, you can also pass a string for the content type | +| parts | `Array`<`any`> | content of the Blob | +| `Optional` properties | `BlobPropertyBag` | `string`| usually `{type: myContentType}`, you can also pass a string for the content type | **Returns:** `Blob` Blob @@ -442,7 +442,7 @@ ___ ▸ **createObjectURL**(blob: *`Blob`*): `string` -Shim for [`URL.createObjectURL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL ) to support browsers that only have the prefixed `webkitURL` (e.g. Android <4.4). +Shim for [`URL.createObjectURL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL) to support browsers that only have the prefixed `webkitURL` (e.g. Android <4.4). Example: @@ -522,7 +522,7 @@ blobUtil.imgSrcToBlob('http://some-other-site.com/img.jpg', 'image/jpeg', | `Optional` quality | `number` | a number between 0 and 1 indicating image quality if the requested type is 'image/jpeg' or 'image/webp' | **Returns:** `Promise`<`Blob`> -Promise that resolves with the Blob +Promise that resolves with the `Blob` ___ @@ -572,7 +572,7 @@ ___ ▸ **revokeObjectURL**(url: *`string`*): `void` -Shim for [`URL.revokeObjectURL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL.revokeObjectURL ) to support browsers that only have the prefixed `webkitURL` (e.g. Android <4.4). +Shim for [`URL.revokeObjectURL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL.revokeObjectURL) to support browsers that only have the prefixed `webkitURL` (e.g. Android <4.4). Example: diff --git a/src/blob-util.ts b/src/blob-util.ts index 4035a14..3c51cab 100644 --- a/src/blob-util.ts +++ b/src/blob-util.ts @@ -18,9 +18,9 @@ import { loadImage, imgToCanvas } from './private' /** * Shim for - * {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob.Blob | new Blob()} + * [`new Blob()`](https://developer.mozilla.org/en-US/docs/Web/API/Blob.Blob) * to support - * {@link http://caniuse.com/blob | older browsers that use the deprecated BlobBuilder API}. + * [older browsers that use the deprecated `BlobBuilder` API](http://caniuse.com/blob). * * Example: * @@ -28,8 +28,8 @@ import { loadImage, imgToCanvas } from './private' * var myBlob = blobUtil.createBlob(['hello world'], {type: 'text/plain'}); * ``` * - * @param parts - content of the Blob - * @param properties - usually {type: myContentType}, + * @param parts - content of the Blob + * @param properties - usually `{type: myContentType}`, * you can also pass a string for the content type * @returns Blob */ @@ -59,9 +59,9 @@ export function createBlob (parts: Array, properties?: BlobPropertyBag | st /** * Shim for - * {@link https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL | URL.createObjectURL()} + * [`URL.createObjectURL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL) * to support browsers that only have the prefixed - * webkitURL (e.g. Android <4.4). + * `webkitURL` (e.g. Android <4.4). * * Example: * @@ -78,9 +78,9 @@ export function createObjectURL (blob: Blob): string { /** * Shim for - * {@link https://developer.mozilla.org/en-US/docs/Web/API/URL.revokeObjectURL | URL.revokeObjectURL()} + * [`URL.revokeObjectURL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL.revokeObjectURL) * to support browsers that only have the prefixed - * webkitURL (e.g. Android <4.4). + * `webkitURL` (e.g. Android <4.4). * * Example: * @@ -95,7 +95,7 @@ export function revokeObjectURL (url: string): void { } /** - * Convert a Blob to a binary string. + * Convert a `Blob` to a binary string. * * Example: * @@ -131,7 +131,7 @@ export function blobToBinaryString (blob: Blob): Promise { } /** - * Convert a base64-encoded string to a Blob. + * Convert a base64-encoded string to a `Blob`. * * Example: * @@ -148,7 +148,7 @@ export function base64StringToBlob (base64: string, type?: string): Blob { } /** - * Convert a binary string to a Blob. + * Convert a binary string to a `Blob`. * * Example: * @@ -165,7 +165,7 @@ export function binaryStringToBlob (binary: string, type?: string): Blob { } /** - * Convert a Blob to a binary string. + * Convert a `Blob` to a binary string. * * Example: * @@ -186,8 +186,8 @@ export function blobToBase64String (blob: Blob): Promise { /** * Convert a data URL string - * (e.g. 'data:image/png;base64,iVBORw0KG...') - * to a Blob. + * (e.g. `'data:image/png;base64,iVBORw0KG...'`) + * to a `Blob`. * * Example: * @@ -207,8 +207,8 @@ export function dataURLToBlob (dataURL: string): Blob { } /** - * Convert a Blob to a data URL string - * (e.g. 'data:image/png;base64,iVBORw0KG...'). + * Convert a `Blob` to a data URL string + * (e.g. `'data:image/png;base64,iVBORw0KG...'`). * * Example: * @@ -226,8 +226,8 @@ export function blobToDataURL (blob: Blob): Promise { } /** - * Convert an image's src URL to a data URL by loading the image and painting - * it to a canvas. + * Convert an image's `src` URL to a data URL by loading the image and painting + * it to a `canvas`. * * Note: this will coerce the image to the desired content type, and it * will only paint the first frame of an animated GIF. @@ -268,7 +268,7 @@ export function imgSrcToDataURL (src: string, type?: string, crossOrigin?: strin } /** - * Convert a canvas to a Blob. + * Convert a `canvas` to a `Blob`. * * Examples: * @@ -295,7 +295,7 @@ export function imgSrcToDataURL (src: string, type?: string, crossOrigin?: strin * @param type - the content type (optional, defaults to 'image/png') * @param quality - a number between 0 and 1 indicating image quality * if the requested type is 'image/jpeg' or 'image/webp' - * @returns Promise that resolves with the Blob + * @returns Promise that resolves with the `Blob` */ export function canvasToBlob (canvas: HTMLCanvasElement, type?: string, quality?: number): Promise { if (typeof canvas.toBlob === 'function') { @@ -307,8 +307,8 @@ export function canvasToBlob (canvas: HTMLCanvasElement, type?: string, quality? } /** - * Convert an image's src URL to a Blob by loading the image and painting - * it to a canvas. + * Convert an image's `src` URL to a `Blob` by loading the image and painting + * it to a `canvas`. * * Note: this will coerce the image to the desired content type, and it * will only paint the first frame of an animated GIF. @@ -338,7 +338,7 @@ export function canvasToBlob (canvas: HTMLCanvasElement, type?: string, quality? * 'Anonymous' to avoid "tainted canvas" errors * @param quality - a number between 0 and 1 indicating image quality * if the requested type is 'image/jpeg' or 'image/webp' - * @returns Promise that resolves with the Blob + * @returns Promise that resolves with the `Blob` */ export function imgSrcToBlob (src: string, type?: string, crossOrigin?: string, quality?: number): Promise { type = type || 'image/png' @@ -349,7 +349,7 @@ export function imgSrcToBlob (src: string, type?: string, crossOrigin?: string, } /** - * Convert an ArrayBuffer to a Blob. + * Convert an `ArrayBuffer` to a `Blob`. * * Example: * @@ -366,7 +366,7 @@ export function arrayBufferToBlob (buffer: ArrayBuffer, type?: string): Blob { } /** - * Convert a Blob to an ArrayBuffer. + * Convert a `Blob` to an `ArrayBuffer`. * * Example: * @@ -379,7 +379,7 @@ export function arrayBufferToBlob (buffer: ArrayBuffer, type?: string): Blob { * ``` * * @param blob - * @returns Promise that resolves with the ArrayBuffer + * @returns Promise that resolves with the `ArrayBuffer` */ export function blobToArrayBuffer (blob: Blob): Promise { return new Promise(function (resolve, reject) { @@ -394,7 +394,7 @@ export function blobToArrayBuffer (blob: Blob): Promise { } /** - * Convert an ArrayBuffer to a binary string. + * Convert an `ArrayBuffer` to a binary string. * * Example: * @@ -417,7 +417,7 @@ export function arrayBufferToBinaryString (buffer: ArrayBuffer): string { } /** - * Convert a binary string to an ArrayBuffer. + * Convert a binary string to an `ArrayBuffer`. * * ```js * var myBuffer = blobUtil.binaryStringToArrayBuffer(binaryString)