How to use flatbuffers - 10 common examples

To help you get started, we’ve selected a few flatbuffers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
bb.writeFloat32(0, 10);
// $ExpectError
bb.writeFloat32(0);
// $ExpectError
bb.writeFloat32("s", "t");

bb.writeFloat64(0, 10);
// $ExpectError
bb.writeFloat64(0);
// $ExpectError
bb.writeFloat64("s", "t");

/**
 * Builder
 */
let b = new fb.Builder();
new fb.Builder(0);
// $ExpectError
new fb.Builder("s");

fb.Builder.growByteBuffer(bb);
// $ExpectError
fb.Builder.growByteBuffer();
// $ExpectError
fb.Builder.growByteBuffer(0);
// $ExpectError
fb.Builder.growByteBuffer("s");

b.forceDefaults(true);
// $ExpectError
b.forceDefaults(0);
// $ExpectError
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// $ExpectError
bb.writeFloat32(0);
// $ExpectError
bb.writeFloat32("s", "t");

bb.writeFloat64(0, 10);
// $ExpectError
bb.writeFloat64(0);
// $ExpectError
bb.writeFloat64("s", "t");

/**
 * Builder
 */
let b = new fb.Builder();
new fb.Builder(0);
// $ExpectError
new fb.Builder("s");

fb.Builder.growByteBuffer(bb);
// $ExpectError
fb.Builder.growByteBuffer();
// $ExpectError
fb.Builder.growByteBuffer(0);
// $ExpectError
fb.Builder.growByteBuffer("s");

b.forceDefaults(true);
// $ExpectError
b.forceDefaults(0);
// $ExpectError
b.forceDefaults("str");
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// $ExpectError
bb.writeFloat32("s", "t");

bb.writeFloat64(0, 10);
// $ExpectError
bb.writeFloat64(0);
// $ExpectError
bb.writeFloat64("s", "t");

/**
 * Builder
 */
let b = new fb.Builder();
new fb.Builder(0);
// $ExpectError
new fb.Builder("s");

fb.Builder.growByteBuffer(bb);
// $ExpectError
fb.Builder.growByteBuffer();
// $ExpectError
fb.Builder.growByteBuffer(0);
// $ExpectError
fb.Builder.growByteBuffer("s");

b.forceDefaults(true);
// $ExpectError
b.forceDefaults(0);
// $ExpectError
b.forceDefaults("str");

b.dataBuffer();
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
la.toFloat64();

la.equals(lb);
// $ExpectError
la.equals(10);

/**
 * ByteBuffer
 */
const arr = new Uint8Array(10);
let bb = new fb.ByteBuffer(arr);
// $ExpectError arg is required
new fb.ByteBuffer();
// $ExpectError arg must be number
new fb.ByteBuffer("s");

fb.ByteBuffer.allocate(10);
// $ExpectError
fb.ByteBuffer.allocate();
// $ExpectError
fb.ByteBuffer.allocate("s");

bb.bytes();
bb.position();

bb.setPosition(1);
// $ExpectError
bb.setPosition();
// $ExpectError
bb.setPosition("s");
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// $ExpectError
new fb.Long.create();
// $ExpectError
new fb.Long.create("s", "t");

la.toFloat64();

la.equals(lb);
// $ExpectError
la.equals(10);

/**
 * ByteBuffer
 */
const arr = new Uint8Array(10);
let bb = new fb.ByteBuffer(arr);
// $ExpectError arg is required
new fb.ByteBuffer();
// $ExpectError arg must be number
new fb.ByteBuffer("s");

fb.ByteBuffer.allocate(10);
// $ExpectError
fb.ByteBuffer.allocate();
// $ExpectError
fb.ByteBuffer.allocate("s");

bb.bytes();
bb.position();

bb.setPosition(1);
// $ExpectError
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
b.createString();
// $ExpectError
b.createString(0);

b.createLong(1, 2);
// $ExpectError
b.createLong();
// $ExpectError
b.createLong("s", "t");

/**
 * flatbuffers
 */
new fb.flatbuffers.Long(1, 2);
new fb.flatbuffers.ByteBuffer(arr);
new fb.flatbuffers.Builder();
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
b.createString(arr);
// $ExpectError
b.createString();
// $ExpectError
b.createString(0);

b.createLong(1, 2);
// $ExpectError
b.createLong();
// $ExpectError
b.createLong("s", "t");

/**
 * flatbuffers
 */
new fb.flatbuffers.Long(1, 2);
new fb.flatbuffers.ByteBuffer(arr);
new fb.flatbuffers.Builder();
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// @flow
import fb from "flatbuffers";

/**
 * Long
 */

let la = new fb.Long(1, 2);
// $ExpectError
new fb.Long();
// $ExpectError
new fb.Long("s", "t");
// $ExpectError
new fb.Long(1);

let lb = fb.Long.create(1, 2);
// $ExpectError
new fb.Long.create();
// $ExpectError
new fb.Long.create("s", "t");

la.toFloat64();

la.equals(lb);
// $ExpectError
la.equals(10);

/**
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// @flow
import fb from "flatbuffers";

/**
 * Long
 */

let la = new fb.Long(1, 2);
// $ExpectError
new fb.Long();
// $ExpectError
new fb.Long("s", "t");
// $ExpectError
new fb.Long(1);

let lb = fb.Long.create(1, 2);
// $ExpectError
new fb.Long.create();
// $ExpectError
new fb.Long.create("s", "t");

la.toFloat64();

la.equals(lb);
// $ExpectError
la.equals(10);

/**
 * ByteBuffer
 */
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// @flow
import fb from "flatbuffers";

/**
 * Long
 */

let la = new fb.Long(1, 2);
// $ExpectError
new fb.Long();
// $ExpectError
new fb.Long("s", "t");
// $ExpectError
new fb.Long(1);

let lb = fb.Long.create(1, 2);
// $ExpectError
new fb.Long.create();
// $ExpectError
new fb.Long.create("s", "t");

la.toFloat64();

la.equals(lb);