# @ecency/bytebuffer

> The swiss army knife for binary data in JavaScript.

Latest version **6.0.0** (published 2024-08-07) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ecency/bytebuffer
pnpm add @ecency/bytebuffer
yarn add @ecency/bytebuffer
bun add @ecency/bytebuffer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2024-08-07 |
| First published | 2024-08-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 1 |
| Unpacked size | 155.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 729 |
| Author | Daniel Wirtz |
| Maintainers | feruzm, talhasch |
| Keywords | net, array, buffer, arraybuffer, typed array, bytebuffer, json, websocket, webrtc |

## Links

- npm: https://www.npmjs.com/package/@ecency/bytebuffer
- Repository: https://github.com/dcodeIO/bytebuffer.js
- Homepage: https://github.com/dcodeIO/bytebuffer.js#readme
- Issues: https://github.com/dcodeIO/bytebuffer.js/issues
- npm.io page: https://npm.io/package/@ecency/bytebuffer

## Dependencies (1)

- [long](https://npm.io/package/long.md) ~3

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 6.0.0 (latest) — 2024-08-07

## README

## Fork Notes:

- Based off of upstream master instead of upstream latest release, because tests were broken on the latest release.
- Removed `new Buffer()` usage.
- Dropped super old Node version support to use `Buffer.alloc`/`Buffer.from`.
- Removed minified/gzipped builds.
- Added `files` to `package.json` for smaller package size.

---

![bytebuffer.js - The swiss army knife for binary data in JavaScript.](https://raw.github.com/dcodeIO/bytebuffer.js/master/bytebuffer.png)
======================================
A fast and complete ByteBuffer implementation using either ArrayBuffers in the browser or node Buffers under node.js,
generated from a single source tree through [MetaScript](https://github.com/dcodeIO/MetaScript).

[![Build Status](https://travis-ci.org/dcodeIO/bytebuffer.js.svg?branch=master)](https://travis-ci.org/dcodeIO/bytebuffer.js)
[![Donate](https://raw.githubusercontent.com/dcodeIO/bytebuffer.js/master/donate.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=dcode%40dcode.io&item_name=%3C3%20bytebuffer.js)

Features
--------
* Three API-compatible versions:
  * **bytebuffer** &nbsp; Backing buffer: ArrayBuffer, Accessor: Uint8Array
  * **bytebuffer-dataview** &nbsp; Backing buffer: ArrayBuffer, Accessor: DataView
  * **bytebuffer-node** &nbsp; Backing buffer / Accessor: node Buffer
* 8, 16, 32 and 64 bit (through [long.js](https://github.com/dcodeIO/long.js)) signed and unsigned integers
* 32 and 64 bit floats
* Varints as used in protobuf (32 and 64 bit, zig-zag)
* [Base64](https://github.com/dcodeIO/lxiv), [utf8](https://github.com/dcodeIO/utfx), binary, hex and debug encodings
* Handy string and debugging utilities
* Big and little endianness
* Relative and absolute zero-copy operations wherever possible
* Transparent resizing when using unknown-length data
* Chaining of all operations that do not return a specific value
* Slicing, appending, prepending, reversing, flip, mark, reset, etc.

Usage
-----
The library is compatible with CommonJS and AMD loaders and is exposed globally as `dcodeIO.ByteBuffer` if neither is
available.

```javascript
var ByteBuffer = require("bytebuffer");

var bb = new ByteBuffer()
            .writeIString("Hello world!")
            .flip();
console.log(bb.readIString()+" from bytebuffer.js");
```

In the browser, 64 bit integer support is optional and present only if [Long.js](https://github.com/dcodeIO/long.js) has
been loaded prior to bytebuffer.js.

API
---
* [View the API documentation](https://github.com/dcodeIO/bytebuffer.js/wiki/API)
* [Check the wiki](https://github.com/dcodeIO/bytebuffer.js/wiki)

Downloads
---------
* [Distributions](https://github.com/dcodeIO/bytebuffer.js/tree/master/dist)
* [ZIP-Archive](https://github.com/dcodeIO/bytebuffer.js/archive/master.zip)
* [Tarball](https://github.com/dcodeIO/bytebuffer.js/tarball/master)

Support for IE<10, FF<15, Chrome<9 etc.
---------------------------------------
* Use bytebuffer-dataview with a polyfill ([see](https://github.com/dcodeIO/bytebuffer.js/tree/master/dist))

Contributors
------------
[Dretch](https://github.com/Dretch) (IE8 compatibility)

License
-------
**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) - Logo derived from [W3C HTML5 Logos](http://www.w3.org/html/logo/) (CC A 3.0)

---
_Source: https://npm.io/package/@ecency/bytebuffer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
