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

fix: enforce correct types

Browse files
Files changed (1) hide show
  1. packages/web/src/record.ts +20 -3
packages/web/src/record.ts CHANGED
@@ -345,6 +345,17 @@ export class LeRobotDatasetRecorder {
345
  fps: number;
346
  taskDescription: string;
347
 
 
 
 
 
 
 
 
 
 
 
 
348
  constructor(
349
  teleoperators: WebTeleoperator[],
350
  videoStreams: { [key: string]: MediaStream },
@@ -877,7 +888,9 @@ export class LeRobotDatasetRecorder {
877
  writerProperties
878
  );
879
  const numpadded = i.toString().padStart(6, "0");
880
- const content = new Blob([parquetUint8Array]);
 
 
881
 
882
  episodeBlobs.push({
883
  content,
@@ -1373,11 +1386,15 @@ export class LeRobotDatasetRecorder {
1373
  },
1374
  {
1375
  path: "meta/tasks.parquet",
1376
- content: new Blob([tasksParquet]),
 
 
1377
  },
1378
  {
1379
  path: "meta/episodes/chunk-000/file-000.parquet",
1380
- content: new Blob([episodesParquet]),
 
 
1381
  },
1382
  {
1383
  path: "README.md",
 
345
  fps: number;
346
  taskDescription: string;
347
 
348
+ /**
349
+ * Ensures BlobPart compatibility across environments by converting Uint8Array
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(
360
  teleoperators: WebTeleoperator[],
361
  videoStreams: { [key: string]: MediaStream },
 
888
  writerProperties
889
  );
890
  const numpadded = i.toString().padStart(6, "0");
891
+ const content = new Blob([
892
+ LeRobotDatasetRecorder.toArrayBuffer(parquetUint8Array as Uint8Array),
893
+ ]);
894
 
895
  episodeBlobs.push({
896
  content,
 
1386
  },
1387
  {
1388
  path: "meta/tasks.parquet",
1389
+ content: new Blob([
1390
+ LeRobotDatasetRecorder.toArrayBuffer(tasksParquet as Uint8Array),
1391
+ ]),
1392
  },
1393
  {
1394
  path: "meta/episodes/chunk-000/file-000.parquet",
1395
+ content: new Blob([
1396
+ LeRobotDatasetRecorder.toArrayBuffer(episodesParquet as Uint8Array),
1397
+ ]),
1398
  },
1399
  {
1400
  path: "README.md",