NERDDISCO commited on
Commit
ea0b085
·
1 Parent(s): 209b58a

fix: more types

Browse files
Files changed (1) hide show
  1. packages/web/src/record.ts +11 -4
packages/web/src/record.ts CHANGED
@@ -350,10 +350,17 @@ export class LeRobotDatasetRecorder {
350
  * to an ArrayBuffer with correct bounds and ArrayBuffer typing.
351
  */
352
  private static toArrayBuffer(uint8: Uint8Array): ArrayBuffer {
353
- return uint8.buffer.slice(
354
- uint8.byteOffset,
355
- uint8.byteOffset + uint8.byteLength
356
- );
 
 
 
 
 
 
 
357
  }
358
 
359
  constructor(
 
350
  * to an ArrayBuffer with correct bounds and ArrayBuffer typing.
351
  */
352
  private static toArrayBuffer(uint8: Uint8Array): ArrayBuffer {
353
+ const buffer = uint8.buffer;
354
+ if (buffer instanceof ArrayBuffer) {
355
+ return buffer.slice(
356
+ uint8.byteOffset,
357
+ uint8.byteOffset + uint8.byteLength
358
+ );
359
+ }
360
+ // Handle SharedArrayBuffer case by copying to ArrayBuffer
361
+ const arrayBuffer = new ArrayBuffer(uint8.byteLength);
362
+ new Uint8Array(arrayBuffer).set(uint8);
363
+ return arrayBuffer;
364
  }
365
 
366
  constructor(