Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@protobuf-ts/plugin

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@protobuf-ts/plugin

The protocol buffer compiler plugin "protobuf-ts" generates TypeScript, gRPC-web, Twirp, and more.

  • 2.9.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
199K
increased by5.35%
Maintainers
1
Weekly downloads
 
Created

What is @protobuf-ts/plugin?

@protobuf-ts/plugin is a TypeScript plugin for Protocol Buffers (protobuf). It generates TypeScript code from .proto files, enabling developers to work with protobuf messages in a type-safe manner. The plugin supports both client and server-side code generation, making it versatile for various use cases.

What are @protobuf-ts/plugin's main functionalities?

TypeScript Code Generation

This feature allows you to generate TypeScript code from .proto files. The generated code includes type definitions and service clients, making it easier to work with protobuf messages in a type-safe manner.

```json
{
  "scripts": {
    "generate": "protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=./generated -I ./protos ./protos/*.proto"
  }
}
```

Client-Side Code Generation

This feature generates client-side code for interacting with protobuf services. The generated client can be used to make RPC calls to a server that implements the protobuf service.

```typescript
import { MyServiceClient } from './generated/my-service.client';

const client = new MyServiceClient('http://localhost:8080');
client.myMethod({ myField: 'value' }).then(response => {
  console.log(response);
});
```

Server-Side Code Generation

This feature generates server-side code for implementing protobuf services. The generated server can be used to handle RPC calls from clients.

```typescript
import { MyServiceServer } from './generated/my-service.server';

class MyServiceImpl implements MyServiceServer {
  myMethod(request) {
    return { myField: 'response' };
  }
}
```

Other packages similar to @protobuf-ts/plugin

Keywords

FAQs

Package last updated on 13 Mar 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc