buffer-alloc-unsafe

WebJar for buffer-alloc-unsafe

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

buffer-alloc-unsafe
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

buffer-alloc-unsafe
WebJar for buffer-alloc-unsafe
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/LinusU/buffer-alloc-unsafe

Download buffer-alloc-unsafe

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/buffer-alloc-unsafe/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>buffer-alloc-unsafe</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/buffer-alloc-unsafe/
implementation 'org.webjars.npm:buffer-alloc-unsafe:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/buffer-alloc-unsafe/
implementation ("org.webjars.npm:buffer-alloc-unsafe:1.1.0")
'org.webjars.npm:buffer-alloc-unsafe:jar:1.1.0'
<dependency org="org.webjars.npm" name="buffer-alloc-unsafe" rev="1.1.0">
  <artifact name="buffer-alloc-unsafe" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='buffer-alloc-unsafe', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "buffer-alloc-unsafe" % "1.1.0"
[org.webjars.npm/buffer-alloc-unsafe "1.1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Buffer Alloc Unsafe

A ponyfill for Buffer.allocUnsafe.

Works as Node.js: v7.0.0
Works on Node.js: v0.10.0

Installation

npm install --save buffer-alloc-unsafe

Usage

const allocUnsafe = require('buffer-alloc-unsafe')

console.log(allocUnsafe(10))
//=> <Buffer 78 0c 80 03 01 00 00 00 05 00>

console.log(allocUnsafe(10))
//=> <Buffer 58 ed bf 5f ff 7f 00 00 01 00>

console.log(allocUnsafe(10))
//=> <Buffer 50 0c 80 03 01 00 00 00 0a 00>

allocUnsafe(-10)
//=> RangeError: "size" argument must not be negative

API

allocUnsafe(size)

  • size <Integer> The desired length of the new Buffer

Allocates a new non-zero-filled Buffer of size bytes. The size must be less than or equal to the value of buffer.kMaxLength and greater than or equal to zero. Otherwise, a RangeError is thrown.

See also

Versions

Version
1.1.0