mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 21:28:40 +00:00
Rename files
This commit is contained in:
20
ts/util/arrayBufferToObjectURL.std.ts
Normal file
20
ts/util/arrayBufferToObjectURL.std.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2018 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { MIMEType } from '../types/MIME.std.js';
|
||||
|
||||
export const arrayBufferToObjectURL = ({
|
||||
data,
|
||||
type,
|
||||
}: {
|
||||
data: ArrayBuffer;
|
||||
type: MIMEType;
|
||||
}): string => {
|
||||
if (!(data instanceof ArrayBuffer)) {
|
||||
throw new TypeError('`data` must be an ArrayBuffer');
|
||||
}
|
||||
|
||||
const blob = new Blob([data], { type });
|
||||
|
||||
return URL.createObjectURL(blob);
|
||||
};
|
||||
Reference in New Issue
Block a user