MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / stringToArrayBuffer

Function stringToArrayBuffer

frontend/packages/common/src/utils/download.ts:19–26  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

17}
18
19const stringToArrayBuffer = (str: string): ArrayBuffer => {
20 const buffer = new ArrayBuffer(str.length)
21 const view = new Uint8Array(buffer)
22 for (let i = 0; i < str.length; i++) {
23 view[i] = str.charCodeAt(i) & 0xff
24 }
25 return buffer
26}
27
28export const createBlobUrl = (data: string, fileType: string): string => {
29 // Create a Blob URL from the given data and file type.

Callers 1

createBlobUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected