# protobufit

> Convert any schema to a Protocol Buffer .proto file

Latest version **1.0.0** (published 2015-09-04) · ISC license · 0 weekly downloads

## Install

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

Provides the command `protobufit`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-09-04 |
| First published | 2015-09-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Karissa McKelvey |
| Maintainers | karissa |

## Links

- npm: https://www.npmjs.com/package/protobufit
- Repository: https://github.com/karissa/protobufit
- Issues: https://github.com/karissa/protobufit/issues
- npm.io page: https://npm.io/package/protobufit

## Dependencies (4)

- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [sql-protobuf](https://npm.io/package/sql-protobuf.md) ^1.0.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^1.5.0
- [jsonschema-protobuf](https://npm.io/package/jsonschema-protobuf.md) ^1.0.1

## Recent versions

- 1.0.0 (latest) — 2015-09-04

## README

# protobufit

Converts various schema types into [Protocol Buffers](https://developers.google.com/protocol-buffers/?hl=en) format (v2).

Supports:
  * [SQL `CREATE TABLE` statements](http://www.w3schools.com/sql/sql_create_table.asp)
  * [JSON Schema](json-schema.org)

Yes, this handles:
  * Multiple schema definitions in a single file
  * Tries to auto-detect the given schema format if not specified
  * `required` and `repeated`

```
npm install -g protobufit
```

### CLI usage

```
protobufit [input-file] [-f <format>]
  <format>: 'sql' or 'jsonschema'
```


### Example

```
protobufit schema.sql -f sql > schema.proto
```

schema.sql
```
CREATE TABLE "pluto" (
  "boroughtext" text,
  "block" integer,
  "lot" bigint,
  "cd" date NOT NULL,
);
```

schema.proto
```
syntax = "proto2";

message pluto {
  optional string boroughtext = 1;
  optional int32 block = 2;
  optional int64 lot = 3;
  required string cd = 4;
```

### JS usage

```js
var protobufit = require('protobufit')
var data = fs.readFileSync('schema.sql').toString()
var opts = {format: 'sql'}
console.log(protobufit(data, opts))
```

### TODO
  * datapackage.json
  * Rdata?

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