npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

DynamicBuffer

v0.1.0

Published

Dynamic buffers can be used for fast string concatenation. They are initialized with a fixed size node Buffer, which will be replaced with a larger one transparently when needed.

Downloads

42

Readme

DynamicBuffer, a wrapper around node.js Buffer class

The Buffer class of node.js by default cannot be used as buffer to concatenate strings, like StringBuilder known from java [http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html]. This module contains a wrapper around node.js Buffer to concatenate strings into a Buffer, while automatically creating larger Buffers in the background, if more space is needed.

/**
 * constructor, takes a starting size for the underlying buffer
 * and a factor, in which the buffer grows, if it gets to small.
 * Both have defaults (512 and 2.0).
 */
var DynamicBuffer = module.exports = function(_size, _factor)

/**
 * append a string to the buffer and return it for chaining
 */
DynamicBuffer.prototype.append = function(_string)

/**
 * append a byte to the buffer and return it for chaining
 */
DynamicBuffer.prototype.write = function(_byte)

/**
 * append a javascript (V8) buffer or DynamicBuffer to this one
 * and return it for chaining
 */
DynamicBuffer.prototype.concat = function(_buffer)

/**
 * get a copy of this DynamicBuffer. Changing one of the buffers does
 * not change the other one. Will accept an optional size for the copy.
 * If not given, the new one will be exactly the same as the original.
 */
DynamicBuffer.prototype.clone = function(_newBufferSize, _newResizeFactor)

/**
 * shrinks this buffer either to the given size, or the length of the current buffer.
 * This method is mainly used to squeeze out the last bytes of memory, or increase the
 * size for large chunks of data to come
 */
DynamicBuffer.prototype.resizeUnderlyingBuffer = function(_size)

/**
 * return a view of the underlying buffer that only contains the written space.
 * Changing that view will change this buffer, too.
 */
DynamicBuffer.prototype.getBuffer = function()