https://github.com/larswaechter/bufferlo.js
A TypeScript library built for the Node Buffer class.
https://github.com/larswaechter/bufferlo.js
buffer buffer-management buffering buffers library nodejs
Last synced: 7 months ago
JSON representation
A TypeScript library built for the Node Buffer class.
- Host: GitHub
- URL: https://github.com/larswaechter/bufferlo.js
- Owner: larswaechter
- License: mit
- Created: 2021-10-27T16:26:35.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-08T14:45:52.000Z (almost 4 years ago)
- Last Synced: 2025-02-22T22:21:51.787Z (7 months ago)
- Topics: buffer, buffer-management, buffering, buffers, library, nodejs
- Language: TypeScript
- Homepage: https://larswaechter.github.io/bufferlo.js/
- Size: 165 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# bufferlo.js
A TypeScript library built for the Node Buffer class.
[](https://nodei.co/npm/bufferlo.js/)

## Introduction
bufferlo.js is TypeScript library that simplifies the work with Node's [Buffer](https://nodejs.org/api/buffer.html) class. It uses a `Buffer` instance under the hood and provides multiple methods to interact with this buffer.
What is a Buffer? ([Source](https://nodejs.org/en/knowledge/advanced/buffers/how-to-use-buffers/))
> The `Buffer` class in Node.js is designed to handle raw binary data. Each buffer corresponds to some raw memory allocated outside V8. Buffers act somewhat like arrays of integers, but aren't resizable and have a whole bunch of methods specifically for binary data. The integers in a buffer each represent a byte and so are limited to values from 0 to 255 inclusive.
## 💻 Installation
Install via npm:
```bash
npm i --save bufferlo.js
```## 🔨 Usage
How to import bufferlo.js and how to use it. You can find all methods in the [docs](https://larswaechter.github.io/bufferlo.js/).
```js
// ES6: import Bufferlo from 'bufferlo.js';
const Bufferlo = require('bufferlo.js');const bf = new Bufferlo();
bf.alloc(3);bf.append('a');
bf.append('b');
bf.available(); // 1 byte
bf.toDecimal(); // 097098000bf.write('xyz');
bf.fit('a'); // false
bf.available(); // 0 bytesbf.extend(5);
bf.length; // 8 bytes
bf.available(); // 5 bytesbf.openFile('./dummy.txt');
bf.writeToFileSync(); // writes 'xyz' to dummy.txtbf.buffer; // Access the raw `Buffer` instance
```## 📚 Documentation
You can find the complete documentation including all available methods [here](https://larswaechter.github.io/bufferlo.js/).
Otherwise check out the [tests](https://github.com/larswaechter/bufferlo.js/blob/master/test/index.ts) for a bunch of examples.## 🧩 Contributing
See [CONTRIBUTING.md](https://github.com/larswaechter/bufferlo.js/blob/master/CONTRIBUTING.md)
## 🔑 License
bufferlo.js is released under [MIT](https://github.com/larswaechter/bufferlo.js/blob/master/LICENSE) license.