![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
tsprotobuf-codec
Advanced tools
A browser-compatible protocol buffer encoder/decoder in typescript
A browser-compatible protocol buffer encoder/decoder in typescript
Note: this package is designed to be used from code generated by a protocol buffer code generator, but it can be used in any low-level library or to dynamically construct any arbitrary protocol buffer message. The example here shows one way of doing that.
yarn add tsprotobuf-codec
This provides read and write functions for translating between the wire format and javascript representation of the various proto3 types, such as int32, double, fixed32, etc..
So if you had a protocol buffer that looked something like this:
message MyMessage {
int32 my_number = 1;
string my_string = 2;
}
Then you could write that with the following code (normally raw access like this would be through generated code)
import {WriteField as write, allocateNestingWriter, arrayCollector} from "tsprotobuf-codec";
const myNumber = 42;
const myNumber_field = 1;
const myString = "The ultimate answer";
const myString_field = 2;
// Preallocate a buffer
const writer = allocateNestingWriter(1024);
// Write the fields to the buffer
write.int32(writer, myNumber, myNumber_field);
write.string(writer, myString, myString_field);
// and then get the resulting blob
const encoded = writer.finish(arrayCollector);
yarn install
yarn test
FAQs
A browser-compatible protocol buffer encoder/decoder in typescript
The npm package tsprotobuf-codec receives a total of 1 weekly downloads. As such, tsprotobuf-codec popularity was classified as not popular.
We found that tsprotobuf-codec demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.