# fbagen

> Generate object-based C# accessor code from FlatBuffer schema

Latest version **0.0.3** (published 2016-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install fbagen
pnpm add fbagen
yarn add fbagen
bun add fbagen
```

Provides the command `fbagen`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2016-10-20 |
| First published | 2016-10-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Wu Yuntao |
| Maintainers | wyt.brandon |
| Keywords | FlatBuffer, CSharp |

## Links

- npm: https://www.npmjs.com/package/fbagen
- Repository: https://github.com/wuyuntao/fbagen
- Homepage: https://github.com/wuyuntao/fbagen#readme
- Issues: https://github.com/wuyuntao/fbagen/issues
- npm.io page: https://npm.io/package/fbagen

## Dependencies (3)

- [meow](https://npm.io/package/meow.md) ^3.7.0
- [jison](https://npm.io/package/jison.md) ^0.4.17
- [uppercamelcase](https://npm.io/package/uppercamelcase.md) ^1.1.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2016-10-20
- 0.0.2 — 2016-10-19
- 0.0.1 — 2016-10-19

## README

# fbagen

[fbagen](https://github.com/wuyuntao/fbagen) generates object-based accessor code from [FlatBuffers](https://google.github.io/flatbuffers/) schema. Currently fbagen only generate C# code, support of Java / JavaScript is comming soon.

## Motivation

While FlatBuffers provides a performance boost on accessing serialized data, it is a little bit of pain to handwrite serialization code for every message. Especially in the prototype stage, schema changes a lot and serialization code have to be adopted.

fbagen parses FlatBuffers schema with [Jison](https://github.com/zaach/jison) and generates traditional object-based, read-only accessors and serializers for FlatBuffer `struct` or `table`.

## Usage

### Install from NPM

```bash
$ npm install fbagen
$ node_modules/.bin/fbagen -n -o /path/to/accessors /path/to/flatbuffer/schema
```

### Clone from Github
```bash
$ git clone https://github.com/wuyuntao/fbagen.git
$ cd fbagen
$ node index.js -n -o /path/to/accessors /path/to/flatbuffer/schema
```

### Command-line options
```bash
$ node index.js --help

  Generate object-based C# accessor code from FlatBuffer schema

  Usage
    $ fbagen <files>

  Options
    -o, --output-path       Output generated files to path
    -n, --csharp            Generate C# code

  Examples
    $ fbagen -o GeneratedCode -n Schema.fbs
```

### Extra schema attributes

fbagen provides several attributes to customize code generation.

* `use_list`: When this attribute is added to a `Vector` type, fbagen will use `List<T>` as field type instead of `Array`.

## Generated code style

You can find a sample [schema](https://github.com/wuyuntao/fbagen/blob/master/examples/FbagenDemo/Schema.fbs) and [accessors](https://github.com/wuyuntao/fbagen/blob/master/examples/FbagenDemo/SchemaAccessors.cs) here.

## Todo-list

* Support `union` syntax
* Support `include` syntax
* Add accessor generation for Java / JavaScript

---
_Source: https://npm.io/package/fbagen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
