Socket
Socket
Sign inDemoInstall

pg-protocol

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-protocol

The postgres client/server binary protocol, implemented in TypeScript


Version published
Weekly downloads
7.3M
decreased by-4.19%
Maintainers
1
Weekly downloads
 
Created

What is pg-protocol?

The pg-protocol npm package is a low-level library for parsing and serializing the PostgreSQL wire protocol. It is typically used as part of the PostgreSQL client libraries to handle communication with PostgreSQL servers.

What are pg-protocol's main functionalities?

Parsing PostgreSQL messages

This feature allows you to parse messages received from a PostgreSQL server. The `Parser` class emits a 'message' event whenever it successfully parses a message from the provided buffer.

const { Parser } = require('pg-protocol');
const parser = new Parser();
parser.on('message', msg => {
  console.log('Received message:', msg);
});
const buffer = Buffer.from('some binary data from PostgreSQL server');
parser.parse(buffer);

Serializing PostgreSQL messages

This feature allows you to serialize messages to be sent to a PostgreSQL server. The `serialize` function takes a message type and the message content, and returns a buffer that can be sent over the wire.

const { serialize } = require('pg-protocol');
const buffer = serialize('query', 'SELECT * FROM users');
console.log('Serialized buffer:', buffer);

Other packages similar to pg-protocol

FAQs

Package last updated on 17 Sep 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