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);
};