MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / readBlobAsText

Function readBlobAsText

client/src/api/metadata/blob-client.ts:7–21  ·  view source on GitHub ↗
(blob: Blob)

Source from the content-addressed store, hash-verified

5import { DataSource } from '../Models';
6
7function readBlobAsText(blob: Blob): Promise<string> {
8 return new Promise<string>((resolve, reject) => {
9 const reader = new FileReader();
10 reader.onload = () => {
11 const text = reader.result as string;
12 resolve(text);
13 };
14
15 reader.onerror = () => {
16 reject(new Error('Failed to read the Blob as text.'));
17 };
18
19 reader.readAsText(blob);
20 });
21}
22
23async function blobNameToMetadata(blobName: string, containerClient: ContainerClient): Promise<SigMFMetadata> {
24 const fName = blobName.split('.')[0];

Callers 1

blobNameToMetadataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected