# bytebuffer

> The swiss army knife for binary data in JavaScript.

Latest version **5.0.1** (published 2016-02-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install bytebuffer
pnpm add bytebuffer
yarn add bytebuffer
bun add bytebuffer
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.1 |
| Published | 2016-02-12 |
| First published | 2013-02-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | separate (@types/bytebuffer) |
| Module format | CommonJS |
| Node | >=0.8 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 729 |
| Author | Daniel Wirtz |
| Maintainers | dcode |
| Keywords | net, array, buffer, arraybuffer, typed array, bytebuffer, json, websocket, webrtc |

## Links

- npm: https://www.npmjs.com/package/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/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

- 5.0.1 (latest) — 2016-02-12
- 5.0.0 — 2015-10-25
- 4.1.0 — 2015-09-26
- 4.0.0 — 2015-06-25
- 3.5.5 — 2015-06-20
- 3.5.4 — 2014-11-03
- 3.5.3 — 2014-10-23
- 3.5.2 — 2014-10-21
- 3.5.1 — 2014-10-21
- 3.5.0 — 2014-10-14
- 3.4.0 — 2014-10-02
- 3.3.0 — 2014-08-26
- 3.2.3 — 2014-08-26
- 3.2.2 — 2014-08-26
- 3.2.1 — 2014-08-25
- … 53 more at https://npm.io/package/bytebuffer/versions

## README

![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/bytebuffer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
