一覧へ戻る
dishuostec/rollup-plugin-proto(新しいタブで開きます)
主要言語: JavaScript
Rollup probobuf(.proto) files.
- star 数
- 2
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2019/08/29
主要言語: JavaScript
Rollup probobuf(.proto) files.
Convert .proto files into JavaScript module useing pbf.
npm install --save-dev @dishuostec/rollup-plugin-proto
// rollup.config.js import proto from '@dishuostec/rollup-plugin-proto'; export default { input: './src/index.js', plugins: [ proto() ], };
// demo.proto syntax = "proto3"; message SearchRequest { required string query = 1; optional int32 page_number = 2; optional int32 result_per_page = 3; }
// index.js import { SearchRequest } from './demo.proto'; import Pbf from 'pbf'; // read const pbf = new Pbf(buffer); const obj = SearchRequest.read(pbf); // write const pbf = new Pbf(); SearchRequest.write(obj, pbf); const buffer = pbf.finish();