unbuffer

0.0.1 • Public • Published

unbuffer

Interpret Buffer strings generated by NodeJS util.inspect.

Installation

With npm:

$ npm install unbuffer

Usage

Module exports a single function unbuffer which accepts a string and generates an object with the following keys:

  • partial: true if the Buffer is a partial representation (marked with ...)
  • data: a Buffer object whose data matches the string representation
> var unbuffer = require("./");
 
> unbuffer("<Buffer 00 11>")
{ partial: false, data: <Buffer 00 11> }
 
> unbuffer("<Buffer 00 11 22 ...>");
{ partial: true, data: <Buffer 00 11 22> }

The key invariant can be stated in two ways:

util.inspect(unbuffer(str).data) == str.replace(/ \.\.\./,"")
 
unbuffer(util.inspect(buf)).data.compare(buf.slice(0, require('buffer').INSPECT_MAX_BYTES)) == 0

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 License are reserved by the Original Author.

Analytics

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    1

Package Sidebar

Install

npm i unbuffer

Homepage

sheetjs.com/

Weekly Downloads

1

Version

0.0.1

License

Apache-2.0

Last publish

Collaborators

  • sheetjs