# bufrw

> Buffer Reading and Writing

Latest version **1.4.0** (published 2023-10-26) · 0 weekly downloads

## Install

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

## 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 | 1.4.0 |
| Published | 2023-10-26 |
| First published | 2015-03-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.x |
| Dependencies | 4 |
| Unpacked size | 185.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 32 |
| Author | Joshua T Corbin |
| Maintainers | usiarhei, kenns29, shengs, emrahs, zacklk, uber-ospo, russfrank, jcorbin, kriskowal, raynos, abq |

## Links

- npm: https://www.npmjs.com/package/bufrw
- Repository: https://github.com/uber/bufrw
- Issues: https://github.com/uber/bufrw/issues
- npm.io page: https://npm.io/package/bufrw

## Dependencies (4)

- [error](https://npm.io/package/error.md) ^7.0.0
- [hexer](https://npm.io/package/hexer.md) ^1.5.0
- [xtend](https://npm.io/package/xtend.md) ^4.0.0
- [ansi-color](https://npm.io/package/ansi-color.md) ^0.2.1

## Recent versions

- 1.4.0 (latest) — 2023-10-26
- 1.2.1 (alpha) — 2016-03-23
- 1.3.0 — 2019-08-25
- 1.2.0 — 2016-01-29
- 1.1.0 — 2016-01-21
- 1.0.1 — 2016-01-21
- 1.0.0 — 2016-01-21
- 0.9.27 — 2015-12-11
- 0.9.26 — 2015-11-10
- 0.9.25 — 2015-08-26
- 0.9.24 — 2015-05-20
- 0.9.23 — 2015-05-08
- 0.9.22 — 2015-05-08
- 0.9.21 — 2015-05-06
- 0.9.20 — 2015-04-14
- … 20 more at https://npm.io/package/bufrw/versions

## README

# bufrw

Buffer Reading and Writing

## Example

Simple length-prefixed string:

```js
var bufrw = require("bufrw");

var buf = bufrw.toBuffer(bufrw.str1, "hello world");
// <Buffer 0b 68 65 6c 6c 6f 20 77 6f 72 6c 64>
var str = bufrw.fromBuffer(bufrw.str1, buf)
// "hello world"
```

// TODO more examples

## Concept and Motivation

A combinatoric library for synchronous binary buffer reading and writing.

The design is to combine:
- needed byte length calculation
- writing into a pre-allocated buffer
- reading from a buffer

Into a single re-combinable data type, eventually supporting code generation
for efficiency.

Any of those three steps may result in an error, so rather than rely on error
throw/catching we use an error-able result type.

## API Documentation

See docs.jsig

## Installation

`npm install bufrw`

## Tests

`npm test`

## NPM scripts

 - `npm run add-licence` This will add the licence headers.
 - `npm run cover` This runs the tests with code coverage
 - `npm run lint` This will run the linter on your code
 - `npm test` This will run the tests.
 - `npm run trace` This will run your tests in tracing mode.
 - `npm run travis` This is run by travis.CI to run your tests
 - `npm run view-cover` This will show code coverage in a browser

## Contributors

 - Joshua T Corbin

## MIT Licenced

  [build-png]: https://secure.travis-ci.org/uber/bufrw.png
  [build]: https://travis-ci.org/uber/bufrw
  [cover-png]: https://coveralls.io/repos/uber/bufrw/badge.png
  [cover]: https://coveralls.io/r/uber/bufrw
  [dep-png]: https://david-dm.org/uber/bufrw.png
  [dep]: https://david-dm.org/uber/bufrw
  [test-png]: https://ci.testling.com/uber/bufrw.png
  [tes]: https://ci.testling.com/uber/bufrw
  [npm-png]: https://nodei.co/npm/bufrw.png?stars&downloads
  [npm]: https://nodei.co/npm/bufrw

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