You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-18Lines changed: 7 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,17 +5,6 @@
5
5
6
6
**protobuf.js** is a pure JavaScript implementation with TypeScript support for node and the browser. It's super easy to use, blazingly fast and works out of the box on .proto files!
7
7
8
-
**Recommended read:**[Changes in protobuf.js 6.0](https://github.com/dcodeIO/protobuf.js/wiki/Changes-in-protobuf.js-6.0)
| full | 18.5kb | [dist][dist-full] | `require("protobufjs")` | All features. Works with everything.
89
78
| light | 15.5kb | [dist/light][dist-light] | `require("protobufjs/light")` | All features except tokenizer, parser and bundled common types. Works with JSON definitions, pure reflection and static code.
90
-
| minimal | 6.0kb+ | [dist/minimal][dist-minimal] | `require("protobufjs/minimal")` | Just enough to run static code - and nothing else.
79
+
| minimal | 6.0kb+ | [dist/minimal][dist-minimal] | `require("protobufjs/minimal")` | Just enough to run static code. No reflection.
91
80
92
81
In case of doubt you can just use the full library.
93
82
@@ -96,7 +85,7 @@ Examples
96
85
97
86
### Using .proto files
98
87
99
-
It's possible to load existing .proto files using the full library, which parses and compiles the definitions to ready to use runtime message classes:
88
+
It's possible to load existing .proto files using the full library, which parses and compiles the definitions to ready to use reflection-based runtime message classes:
The library also supports services but it doesn't make any assumptions about the actual transport channel. Instead, a user must provide a suitable RPC implementation, which is an asynchronous function that takes the reflected service method, the binary HelloRequest and a node-style callback as its parameters:
229
+
The library also supports services but it doesn't make any assumptions about the actual transport channel. Instead, a user must provide a suitable RPC implementation, which is an asynchronous function that takes the reflected service method, the binary request and a node-style callback as its parameters:
241
230
242
231
```js
243
232
functionrpcImpl(method, requestData, callback) {
@@ -270,14 +259,14 @@ message HelloReply {
270
259
```js
271
260
...
272
261
var Greeter =root.lookup("Greeter");
273
-
var greeter =Greeter.create(/* see below*/ rpcImpl, /* request delimited? */false, /* response delimited? */false);
262
+
var greeter =Greeter.create(/* see above*/ rpcImpl, /* request delimited? */false, /* response delimited? */false);
While using .proto files directly requires the [full library][dist-full](about 18.5kb gzipped) respectively pure reflection/JSON the [light library][dist-light] (about 15.5kb gzipped), pretty much all code but the relatively short descriptors is shared.
458
+
While using .proto files directly requires the [full library][dist-full] respectively pure reflection/JSON the [light library][dist-light], pretty much all code but the relatively short descriptors is shared.
470
459
471
-
Static code, on the other hand, requires just the [minimal library][dist-minimal] (about 6kb gzipped), but generates additional, albeit editable, source code without any reflection features.
460
+
Static code, on the other hand, requires just the [minimal library][dist-minimal], but generates additional, albeit editable, source code without any reflection features.
472
461
473
462
There is no significant difference performance-wise as the code generated statically is pretty much the same as generated at runtime and both are largely interchangeable as seen in the previous section.
0 commit comments