stream-with-known-length-to-buffer

WebJar for stream-with-known-length-to-buffer

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

stream-with-known-length-to-buffer
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

stream-with-known-length-to-buffer
WebJar for stream-with-known-length-to-buffer
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/feross/stream-with-known-length-to-buffer

Download stream-with-known-length-to-buffer

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : once jar [1.3.3,2)

Project Modules

There are no modules declared in this project.

stream-with-known-length-to-buffer travis npm downloads javascript style guide

Convert a Readable Stream with a known length into a Buffer

Sauce Test Status

This package converts a Readable Stream into a Buffer, with just one Buffer allocation (excluding allocations done internally by the streams implementation).

This is lighter-weight choice than stream-to-array when the total stream length is known in advance. This whole package is 15 lines.

This module is used by WebTorrent.

install

npm install stream-with-known-length-to-buffer

usage

var toBuffer = require('stream-with-known-length-to-buffer')

toBuffer(fs.createReadStream('file.txt'), 1000, function (err, buf) {
  if (err) return console.error(err.message)
  console.log(buf)
})

license

MIT. Copyright (c) Feross Aboukhadijeh.

Versions

Version
1.0.2