Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smart-buffer

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smart-buffer

A smarter Buffer that keeps track of its own read and write positions while growing endlessly.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.6M
decreased by-80.74%
Maintainers
1
Weekly downloads
 
Created

What is smart-buffer?

The smart-buffer npm package is a Node.js Buffer management library that provides a more convenient way to work with Node.js Buffers. It allows for automatic Buffer resizing, chainable method calls, and simplified Buffer read/write operations.

What are smart-buffer's main functionalities?

Reading and Writing Data

This feature allows for reading and writing various types of data to and from a buffer. The example shows how to read an 8-bit integer from a SmartBuffer instance.

const SmartBuffer = require('smart-buffer').SmartBuffer;
const buff = SmartBuffer.fromBuffer(Buffer.from([0x01, 0x02, 0x03, 0x04]));
const val = buff.readInt8();

Automatic Buffer Resizing

SmartBuffer automatically resizes the internal Buffer as needed when writing data. The example demonstrates writing a null-terminated string to a SmartBuffer instance without worrying about the Buffer size.

const SmartBuffer = require('smart-buffer').SmartBuffer;
const buff = new SmartBuffer();
buff.writeStringNT('Hello, World!');

Chainable Method Calls

SmartBuffer methods can be chained together for more concise code. The example shows multiple write operations being chained together.

const SmartBuffer = require('smart-buffer').SmartBuffer;
const buff = new SmartBuffer();
buff.writeInt32LE(123).writeStringNT('Hello').writeFloatBE(1.23);

Other packages similar to smart-buffer

Keywords

FAQs

Package last updated on 30 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc