How can I efficiently (no copy, only wrappers) convert a Uint8Array
(payload
) with a non-zero byteOffset
to a ArrayBuffer
such that it can be sent binary-style with the Angular HttpClient.post
method?
public post(requestUrl: string, payload: Uint8Array): Promise<Uint8Array> {
return this.httpClient.post(url, payload, { responseType: 'arraybuffer', headers: new HttpHeaders({ 'Content-Type': "application/octet-stream" }) })
}