🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@protobuf-ts/plugin

Package Overview
Dependencies
Maintainers
1
Versions
98
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.10.0
latest
Source
npm
Version published
Weekly downloads
223K
-8.36%
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

Protocol Buffers

FAQs

Package last updated on 01 May 2025

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