mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-21 18:59:27 +00:00
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
|
* @prettier
|
||||||
*/
|
*/
|
||||||
import * as GoogleChrome from './GoogleChrome';
|
import * as GoogleChrome from './GoogleChrome';
|
||||||
|
import { arrayBufferToObjectURL } from './arrayBufferToObjectURL';
|
||||||
import { missingCaseError } from './missingCaseError';
|
import { missingCaseError } from './missingCaseError';
|
||||||
|
|
||||||
export { GoogleChrome, missingCaseError };
|
export { arrayBufferToObjectURL, GoogleChrome, missingCaseError };
|
||||||
|
|||||||
Reference in New Issue
Block a user