Add arrayBufferToObjectURL
module
This commit is contained in:
parent
e5d90775d0
commit
cad5e417f3
2 changed files with 17 additions and 1 deletions
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 };
|
||||
|
|
Loading…
Reference in a new issue