Files
DefinitelyTyped/types/blob-util/blob-util-tests.ts
Max Battcher 1c845dbe2e Add blob-util typings (#16844)
* Add blob-util typings

Library author is not interested in maintaining Typescript typings. See nolanlawson/blob-util#26

* In blob-util typings, move Typescript version tag

Move the Typescript version tag to the bottom of the headers.
2017-05-31 20:01:02 -07:00

18 lines
948 B
TypeScript

import * as blobUtil from 'blob-util';
const testBlob = new Blob(['abcd']);
blobUtil.base64StringToBlob('abcd'); // $ExpectType Promise<Blob>
blobUtil.createObjectURL(testBlob); // $ExpectType string
blobUtil.imgSrcToBlob('test.jpg'); // $ExpectType Promise<Blob>
blobUtil.createBlob(['abcd']); // $ExpectType Blob
blobUtil.arrayBufferToBlob(new ArrayBuffer(0)); // $ExpectType Promise<Blob>
blobUtil.binaryStringToBlob('0101'); // $ExpectType Promise<Blob>
blobUtil.blobToArrayBuffer(testBlob); // $ExpectType Promise<ArrayBuffer>
blobUtil.blobToBase64String(testBlob); // $ExpectType Promise<string>
blobUtil.blobToBinaryString(testBlob); // $ExpectType Promise<string>
blobUtil.canvasToBlob(new HTMLCanvasElement()); // $ExpectType Promise<Blob>
blobUtil.dataURLToBlob('data:abcd'); // $ExpectType Promise<Blob>
blobUtil.imgSrcToDataURL('test.jpg'); // $ExpectType Promise<string>
blobUtil.revokeObjectURL('blob:example'); // $ExpectType void