Add arrayBufferToObjectURL
module
This commit is contained in:
15
ts/util/arrayBufferToObjectURL.ts
Normal file
15
ts/util/arrayBufferToObjectURL.ts
Normal 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);
|
||||
};
|
@@ -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 };
|
||||
|
Reference in New Issue
Block a user