buffer-alloc

WebJar for buffer-alloc

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

buffer-alloc
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

buffer-alloc
WebJar for buffer-alloc
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

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

Download buffer-alloc

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : buffer-alloc-unsafe jar [1.1.0,2)
org.webjars.npm : buffer-fill jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

Buffer Alloc

A ponyfill for Buffer.alloc.

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

Installation

npm install --save buffer-alloc

Usage

const alloc = require('buffer-alloc')

console.log(alloc(4))
//=> <Buffer 00 00 00 00>

console.log(alloc(6, 0x41))
//=> <Buffer 41 41 41 41 41 41>

console.log(alloc(10, 'linus', 'utf8'))
//=> <Buffer 6c 69 6e 75 73 6c 69 6e 75 73>

API

alloc(size[, fill[, encoding]])

  • size <Integer> The desired length of the new Buffer
  • fill <String> | <Buffer> | <Integer> A value to pre-fill the new Buffer with. Default: 0
  • encoding <String> If fill is a string, this is its encoding. Default: 'utf8'

Allocates a new Buffer of size bytes. If fill is undefined, the Buffer will be zero-filled.

See also

Versions

Version
1.2.0