(
blobClient: AzureBlobClient,
meta: SigMFMetadata,
index: number,
count: number,
blockSize: number,
signal: AbortSignal
)
| 70 | } |
| 71 | |
| 72 | async getIQDataBlockFromBlob( |
| 73 | blobClient: AzureBlobClient, |
| 74 | meta: SigMFMetadata, |
| 75 | index: number, |
| 76 | count: number, |
| 77 | blockSize: number, |
| 78 | signal: AbortSignal |
| 79 | ): Promise<IQDataSlice[]> { |
| 80 | const bytesPerSample = meta.getBytesPerIQSample(); |
| 81 | const offsetBytes = index * blockSize * bytesPerSample; |
| 82 | const countBytes = blockSize * count * bytesPerSample; |
| 83 | // This is ugly but it is the only way to get the blob as an ArrayBuffer |
| 84 | const download = await blobClient.download(offsetBytes, countBytes, { |
| 85 | abortSignal: signal, |
| 86 | }); |
| 87 | const blobBody = await (await download.blobBody).arrayBuffer(); |
| 88 | const iqArray = convertToFloat32(blobBody, meta.getDataType()); |
| 89 | const iqBlocks: IQDataSlice[] = []; |
| 90 | for (let i = 0; i < count; i++) { |
| 91 | const offset = i * blockSize * 2; |
| 92 | const iqBlock = iqArray.slice(offset, offset + blockSize * 2); |
| 93 | iqBlocks.push({ index: index + i, iqArray: iqBlock }); |
| 94 | } |
| 95 | return iqBlocks; |
| 96 | } |
| 97 | } |
no test coverage detected