Skip to content

Commit a242da8

Browse files
committed
Add Table.prototype.serialize method to make ArrayBuffers from Tables
1 parent da0f457 commit a242da8

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

js/src/Arrow.externs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ Table.prototype.batches;
6565
Table.prototype.countBy;
6666
/** @type {?} */
6767
Table.prototype.scan;
68+
/** @type {?} */
69+
Table.prototype.serialize;
6870

6971
var CountByResult = function() {};
7072
/** @type {?} */

js/src/table.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { RecordBatch } from './recordbatch';
1919
import { Col, Predicate } from './predicate';
2020
import { Schema, Field, Struct } from './type';
2121
import { read, readAsync } from './ipc/reader/arrow';
22+
import { writeTableBinary } from './ipc/writer/arrow';
2223
import { isPromise, isAsyncIterable } from './util/compat';
2324
import { Vector, DictionaryVector, IntVector, StructVector } from './vector';
2425
import { ChunkedView } from './vector/chunked';
@@ -179,6 +180,10 @@ export class Table implements DataFrame {
179180
}
180181
return str;
181182
}
183+
// @ts-ignore
184+
public serialize(encoding = 'binary', stream = true) {
185+
return writeTableBinary(this, stream);
186+
}
182187
public rowsToString(separator = ' | '): TableToStringIterator {
183188
return new TableToStringIterator(tableRowsToString(this, separator));
184189
}

0 commit comments

Comments
 (0)