buffer-fill

WebJar for buffer-fill

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

buffer-fill
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

buffer-fill
WebJar for buffer-fill
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/linusu/buffer-fill

Download buffer-fill

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/buffer-fill/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>buffer-fill</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/buffer-fill/
implementation 'org.webjars.npm:buffer-fill:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/buffer-fill/
implementation ("org.webjars.npm:buffer-fill:1.0.0")
'org.webjars.npm:buffer-fill:jar:1.0.0'
<dependency org="org.webjars.npm" name="buffer-fill" rev="1.0.0">
  <artifact name="buffer-fill" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='buffer-fill', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "buffer-fill" % "1.0.0"
[org.webjars.npm/buffer-fill "1.0.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 Fill

A ponyfill for Buffer.fill.

Works as Node.js: v6.4.0
Works on Node.js: v0.10.0

Installation

npm install --save buffer-fill

Usage

const fill = require('buffer-fill')
const buf = Buffer.allocUnsafe(5)

console.log(buf.fill(8))
//=> <Buffer 08 08 08 08 08>

console.log(buf.fill(9, 2, 4))
//=> <Buffer 08 08 09 09 08>

console.log(buf.fill('linus', 'latin1'))
//=> <Buffer 6c 69 6e 75 73>

console.log(buf.fill('\u0222'))
//=> <Buffer c8 a2 c8 a2 c8>

API

fill(buf, value[, offset[, end]][, encoding])

  • value <String> | <Buffer> | <Integer> The value to fill buf with
  • offset <Integer> Where to start filling buf. Default: 0
  • end <Integer> Where to stop filling buf (not inclusive). Default: buf.length
  • encoding <String> If value is a string, this is its encoding. Default: 'utf8'
  • Return: <Buffer> A reference to buf

Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. This is meant to be a small simplification to allow the creation and filling of a Buffer to be done on a single line.

If the final write of a fill() operation falls on a multi-byte character, then only the first bytes of that character that fit into buf are written.

See also

Versions

Version
1.0.0