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
* Support for pre-ES5 environments (except IE8) can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js).
837
834
* Support for [Content Security Policy](https://w3c.github.io/webappsec-csp/)-restricted environments (like Chrome extensions without [unsafe-eval](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval)) can be achieved by generating and using static code instead.
838
835
* If a proper way to work with 64 bit values (uint64, int64 etc.) is required, just install [long.js](https://github.com/dcodeIO/long.js) alongside this library. All 64 bit numbers will then be returned as a `Long` instance instead of a possibly unsafe JavaScript number ([see](https://github.com/dcodeIO/long.js)).
836
+
* For descriptor.proto interoperability, see [ext/descriptor](https://github.com/dcodeIO/protobuf.js/tree/master/ext/descriptor)
// ^ expects a FileDescriptorSet message or buffer, see table below
27
28
28
29
// and start all over again
29
30
```
30
31
31
32
API
32
33
---
33
34
34
-
The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto, including sub-types:
The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto:
| FileDescriptorProto | | dependencies are not supported
41
+
| FileOptions ||
42
+
| FileOptions_OptimizeMode ||
43
+
| SourceCodeInfo | | not supported
44
+
| SourceCodeInfo_Location ||
45
+
| GeneratedCodeInfo | | not supported
46
+
| GeneratedCodeInfo_Annotation ||
47
+
|**DescriptorProto**| Type |
48
+
| MessageOptions ||
49
+
| DescriptorProto_ExtensionRange ||
50
+
| DescriptorProto_ReservedRange ||
51
+
|**FieldDescriptorProto**| Field |
52
+
| FieldDescriptorProto_Label ||
53
+
| FieldDescriptorProto_Type ||
54
+
| FieldOptions ||
55
+
| FieldOptions_CType ||
56
+
| FieldOptions_JSType ||
57
+
|**OneofDescriptorProto**| OneOf |
58
+
| OneofOptions ||
59
+
|**EnumDescriptorProto**| Enum |
60
+
| EnumOptions ||
61
+
| EnumValueDescriptorProto ||
62
+
| EnumValueOptions | | not supported
63
+
|**ServiceDescriptorProto**| Service |
64
+
| ServiceOptions ||
65
+
|**MethodDescriptorProto**| Method |
66
+
| MethodOptions ||
67
+
| UninterpretedOption | | not supported
68
+
| UninterpretedOption_NamePart ||
58
69
59
70
Note that not all features of descriptor.proto translate perfectly to a protobuf.js root instance. A root instance has only limited knowlege of packages or individual files for example, which is then compensated by guessing and generating fictional file names.
71
+
72
+
When using TypeScript, the respective `...$Properties` types can be used to reference specific message types (i.e. `protobuf.Message<DescriptorProto$Properties>`).
0 commit comments