New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bare-buffer

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-buffer - npm Package Compare versions

Comparing version 2.7.1 to 3.0.0-0

8

index.d.ts

@@ -13,6 +13,2 @@ type BufferEncoding =

declare class Buffer extends Uint8Array {
static Buffer: Buffer
static poolSize: number
compare(

@@ -144,2 +140,6 @@ target: Buffer,

declare namespace Buffer {
export { Buffer }
export let poolSize: number
export function isBuffer(value: unknown): value is Buffer

@@ -146,0 +146,0 @@

@@ -24,2 +24,40 @@ const constants = require('./lib/constants')

constructor(arrayBuffer, offset, length, opts = {}) {
if (typeof arrayBuffer === 'number') {
opts = offset || {}
const { uninitialized = false } = opts
offset = 0
length = arrayBuffer
if (length > constants.MAX_LENGTH) {
throw new RangeError(
`Buffer length must be at most ${constants.MAX_LENGTH}`
)
}
arrayBuffer = uninitialized
? binding.allocUnsafe(length)
: binding.alloc(length)
} else {
if (length > constants.MAX_LENGTH) {
throw new RangeError(
`Buffer length must be at most ${constants.MAX_LENGTH}`
)
}
if (typeof offset === 'object' && offset !== null) {
opts = offset
offset = 0
length = arrayBuffer.byteLength
} else if (typeof length === 'length' && length !== null) {
opts = length
length = arrayBuffer.byteLength - offset
}
}
super(arrayBuffer, offset, length)
}
[Symbol.species]() {

@@ -538,8 +576,3 @@ return Buffer

exports.allocUnsafe = function allocUnsafe(size) {
binding.setZeroFillEnabled(0)
try {
return new Buffer(size)
} finally {
binding.setZeroFillEnabled(1)
}
return new Buffer(size, { uninitialized: true })
}

@@ -546,0 +579,0 @@

module.exports = {
MAX_LENGTH: 2 ** 32, // 4 GiB
MAX_LENGTH: 2 ** 32 - 1, // 4 GiB
MAX_STRING_LENGTH: 2 ** 28 - 16 // ~512 MiB, lowest common limit
}
{
"name": "bare-buffer",
"version": "2.7.1",
"version": "3.0.0-0",
"description": "Native buffers for JavaScript",

@@ -26,3 +26,3 @@ "exports": {

"scripts": {
"test": "prettier . --check && bare test/all.js"
"test": "prettier . --check && bare test.js"
},

@@ -39,2 +39,5 @@ "repository": {

"homepage": "https://github.com/holepunchto/bare-buffer#readme",
"engines": {
"bare": ">=1.13.0"
},
"devDependencies": {

@@ -41,0 +44,0 @@ "brittle": "^3.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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