How to use the flatbuffers.flatbuffers function in flatbuffers

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
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 lutzroeder / netron / src / armnn.js View on Github external
/* jshint esversion: 6 */
/* eslint "indent": [ "error", 4, { "SwitchCase": 1 } ] */

var armnn = armnn || {};
var base = base || require('./base');
var flatbuffers = flatbuffers || require('flatbuffers').flatbuffers;
var long = long || { Long: require('long') };

armnn.ModelFactory = class {

    match(context) {
        const extension = context.identifier.split('.').pop().toLowerCase();
        if (extension == 'armnn') {
            return true;
        }
        return false;
    }

    open(context, host) {
        return host.require('./armnn-schema').then((armnn_schema) => {
            const identifier = context.identifier;
            let model = null;
github lutzroeder / netron / src / mnn.js View on Github external
/* jshint esversion: 6 */
/* eslint "indent": [ "error", 4, { "SwitchCase": 1 } ] */

var mnn = mnn || {};
var base = base || require('./base');
var flatbuffers = flatbuffers || require('flatbuffers').flatbuffers;

mnn.ModelFactory = class {

    match(context) {
        const extension = context.identifier.split('.').pop().toLowerCase();
        if (extension == 'mnn') {
            return true;
        }
        return false;
    }

    open(context, host) {
        return host.require('./mnn-schema').then((mnn_schema) => {
            const identifier = context.identifier;
            let net = null;
            try {
github lutzroeder / netron / src / tflite.js View on Github external
/* jshint esversion: 6 */
/* eslint "indent": [ "error", 4, { "SwitchCase": 1 } ] */

var tflite = tflite || {};
var base = base || require('./base');
var flatbuffers = flatbuffers || require('flatbuffers').flatbuffers;
var long = long || { Long: require('long') };

tflite.ModelFactory = class {

    match(context) {
        const extension = context.identifier.split('.').pop().toLowerCase();
        if (extension == 'tflite' || extension == 'lite') {
            return true;
        }
        if (extension == 'tfl' || extension == 'bin') {
            const buffer = context.buffer;
            const signature = [ 0x54, 0x46, 0x4c, 0x33 ]; // TFL3
            if (buffer && buffer.length > 8 && signature.every((x, i) => x == buffer[i + 4])) {
                return true;
            }
        }