Add `arrayBufferToObjectURL` module

This commit is contained in:
Daniel Gasienica 2018-04-13 22:14:58 -04:00
parent e5d90775d0
commit cad5e417f3
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,15 @@
/**
* @prettier
*/
import { MIMEType } from '../types/MIME';
export const arrayBufferToObjectURL = ({
data,
type,
}: {
data: ArrayBuffer;
type: MIMEType;
}): string => {
const blob = new Blob([data], { type });
return URL.createObjectURL(blob);
};

View File

@ -2,6 +2,7 @@
* @prettier
*/
import * as GoogleChrome from './GoogleChrome';
import { arrayBufferToObjectURL } from './arrayBufferToObjectURL';
import { missingCaseError } from './missingCaseError';
export { GoogleChrome, missingCaseError };
export { arrayBufferToObjectURL, GoogleChrome, missingCaseError };