Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanmonstar/buf
Auto buffer and unbuffer utilities.
https://github.com/seanmonstar/buf
Last synced: about 1 month ago
JSON representation
Auto buffer and unbuffer utilities.
- Host: GitHub
- URL: https://github.com/seanmonstar/buf
- Owner: seanmonstar
- License: mpl-2.0
- Created: 2014-06-30T17:43:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-06-19T23:29:05.000Z (over 7 years ago)
- Last Synced: 2024-08-09T02:17:59.017Z (3 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# buf
A simple utility for converting between Strings and Buffers.
```js
var buf = require('buf');var aBuffer = buf.hex(strOrBuf);
var aString = buf.to.hex(strOrBuf);
```## API
- buf(stringOrBuffer, encoding): Buffer - Converts value to a Buffer.
- unbuf(stringOrBuffer, encoding): String - Converts value to a String
- aliases: `buf.unbuf`, `buf.un`, `buf.str`, `buf.to`
- encoding methods
- All the encodings that native Buffers can handle are methods on
`buf` and `unbuf`. These are useful if you'll only ever be using 1
encoding, such as: `var buf = require('buf').base64; buf(val)`.## License
MPLv2.0