Socket
Socket
Sign inDemoInstall

buffer-alloc

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

15

index.js

@@ -1,2 +0,5 @@

function alloc (size, fill, encoding) {
var bufferFill = require('buffer-fill')
var allocUnsafe = require('buffer-alloc-unsafe')
module.exports = function alloc (size, fill, encoding) {
if (typeof size !== 'number') {

@@ -10,3 +13,3 @@ throw new TypeError('"size" argument must be a number')

var buffer = new Buffer(size)
var buffer = allocUnsafe(size)

@@ -18,4 +21,3 @@ if (size === 0) {

if (fill === undefined) {
buffer.fill(0)
return buffer
return bufferFill(buffer, 0)
}

@@ -27,6 +29,3 @@

buffer.fill(fill, encoding)
return buffer
return bufferFill(buffer, fill, encoding)
}
module.exports = (Buffer.alloc || alloc)
{
"name": "buffer-alloc",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -9,9 +9,9 @@ "repository": "LinusU/buffer-alloc",

},
"dependencies": {
"buffer-alloc-unsafe": "^0.1.0",
"buffer-fill": "^0.1.0"
},
"devDependencies": {
"standard": "^7.1.2"
},
"engineStrict": true,
"engines": {
"node": ">= 0.12"
},
"keywords": [

@@ -18,0 +18,0 @@ "alloc",

# Buffer Alloc
A ponyfill for `Buffer.alloc`, uses native implementation if available.
A ponyfill for `Buffer.alloc`.
Works as Node.js: `v7.0.0` <br>
Works on Node.js: `v0.10.0`
## Installation

@@ -38,3 +41,4 @@

- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc