Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
The pg-int8 npm package is designed to handle 64-bit integers (int8) in PostgreSQL. It provides functionality to parse and serialize 64-bit integers, which are not natively supported in JavaScript due to its limitation of 53-bit integer precision.
Parsing 64-bit Integers
This feature allows you to parse a string representation of a 64-bit integer into a BigInt in JavaScript. This is useful when dealing with PostgreSQL int8 values.
const pgInt8 = require('pg-int8');
const parsedValue = pgInt8.parse('9223372036854775807');
console.log(parsedValue); // 9223372036854775807n
Serializing 64-bit Integers
This feature allows you to serialize a BigInt in JavaScript back into a string representation of a 64-bit integer. This is useful when you need to store or transmit int8 values to PostgreSQL.
const pgInt8 = require('pg-int8');
const serializedValue = pgInt8.serialize(9223372036854775807n);
console.log(serializedValue); // '9223372036854775807'
The big-integer package provides arbitrary-precision arithmetic in JavaScript. It allows you to handle integers larger than the JavaScript Number type can natively support. While it is more general-purpose compared to pg-int8, it can be used to handle 64-bit integers as well.
The bignumber.js package is another library for arbitrary-precision arithmetic. It is similar to big-integer but also supports floating-point numbers. It can be used to handle 64-bit integers, but it is more versatile and can handle a wider range of numeric operations.
64-bit big-endian signed integer-to-string conversion designed for pg.
const readInt8 = require('pg-int8');
readInt8(Buffer.from([0, 1, 2, 3, 4, 5, 6, 7]))
// '283686952306183'
FAQs
64-bit big-endian signed integer-to-string conversion
We found that pg-int8 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.