{"_id":"binstring","_rev":"3276919","name":"binstring","description":"Convert binary data to and from various string representations","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"jprichardson","email":""},{"name":"midnightlightning","email":"boydb@midnightdesign.ws"},{"name":"nadav","email":""},{"name":"sidazhang","email":"sidazhang89@gmail.com"}],"time":{"modified":"2024-03-21T10:32:08.000Z","created":"2014-01-02T16:03:07.385Z","0.2.1":"2014-04-13T22:27:39.438Z","0.2.0":"2014-01-20T19:26:13.462Z","0.1.0":"2014-01-02T16:03:07.385Z"},"users":{},"repository":{"url":"https://github.com/cryptocoinjs/binstring","type":"git"},"versions":{"0.2.1":{"name":"binstring","version":"0.2.1","description":"Convert binary data to and from various string representations","keywords":["string","strings","convert","hex","bytes"],"devDependencies":{"mocha":"1.*","terst":"0.1.0"},"repository":{"url":"https://github.com/cryptocoinjs/binstring","type":"git"},"main":"./lib/binstring.js","bugs":{"url":"https://github.com/cryptocoinjs/binstring/issues"},"homepage":"https://github.com/cryptocoinjs/binstring","_id":"binstring@0.2.1","dist":{"shasum":"8a174d301f6d54efda550dd98bb4cb524eacd75d","size":2663,"noattachment":false,"key":"/binstring/-/binstring-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binstring/download/binstring-0.2.1.tgz"},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"jp","email":"jprichardson@gmail.com"},"maintainers":[{"name":"jprichardson","email":""},{"name":"midnightlightning","email":"boydb@midnightdesign.ws"},{"name":"nadav","email":""},{"name":"sidazhang","email":"sidazhang89@gmail.com"}],"directories":{},"publish_time":1397428059438,"_hasShrinkwrap":false,"_cnpm_publish_time":1397428059438,"_cnpmcore_publish_time":"2021-12-16T13:31:21.587Z"},"0.2.0":{"name":"binstring","version":"0.2.0","description":"Convert binary data to and from various string representations","keywords":["string","strings","convert","hex","bytes"],"devDependencies":{"mocha":"1.*","terst":"0.0.1"},"repository":{"url":"https://github.com/cryptocoinjs/binstring","type":"git"},"main":"./lib/binstring.js","readmeFilename":"README.md","bugs":{"url":"https://github.com/cryptocoinjs/binstring/issues"},"homepage":"https://github.com/cryptocoinjs/binstring","_id":"binstring@0.2.0","dist":{"shasum":"ba2c1526f4f568f86f0037d6757b6c2f467cceb9","size":813768,"noattachment":false,"key":"/binstring/-/binstring-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binstring/download/binstring-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.13","_npmUser":{"name":"midnightlightning","email":"boydb@midnightdesign.ws"},"maintainers":[{"name":"jprichardson","email":""},{"name":"midnightlightning","email":"boydb@midnightdesign.ws"},{"name":"nadav","email":""},{"name":"sidazhang","email":"sidazhang89@gmail.com"}],"directories":{},"publish_time":1390245973462,"_hasShrinkwrap":false,"_cnpm_publish_time":1390245973462,"_cnpmcore_publish_time":"2021-12-16T13:31:23.596Z"},"0.1.0":{"name":"binstring","version":"0.1.0","description":"Convert binary data to and from various string representations","keywords":["string","strings","convert","hex","bytes"],"devDependencies":{"mocha":"1.*","terst":"0.0.1"},"repository":{"url":"https://github.com/cryptocoinjs/binstring","type":"git"},"main":"./lib/binstring.js","readmeFilename":"README.md","bugs":{"url":"https://github.com/cryptocoinjs/binstring/issues"},"homepage":"https://github.com/cryptocoinjs/binstring","_id":"binstring@0.1.0","dist":{"shasum":"96177304a320b70c543ace3d3c35fedcdc4787b5","size":814679,"noattachment":false,"key":"/binstring/-/binstring-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binstring/download/binstring-0.1.0.tgz"},"_from":".","_npmVersion":"1.3.13","_npmUser":{"name":"midnightlightning","email":"boydb@midnightdesign.ws"},"maintainers":[{"name":"jprichardson","email":""},{"name":"midnightlightning","email":"boydb@midnightdesign.ws"},{"name":"nadav","email":""},{"name":"sidazhang","email":"sidazhang89@gmail.com"}],"directories":{},"publish_time":1388678587385,"_hasShrinkwrap":false,"_cnpm_publish_time":1388678587385,"_cnpmcore_publish_time":"2021-12-16T13:31:26.069Z"}},"readme":"# BinString\n\nJavaScript component to convert to/from strings and byte arrays.\n\nAMD/CommonJS compatible.\n\n\n## Usage\n\nThis library exposes a single function that takes a data parameter and an options object. Set `options.in` and `options.out` to the format of the input and desired output. Possible values include:\n\n* `hex`: Hex-encoded string; two hexadecimal characters per byte\n* `binary`: Binary-encoded string (ASCII-encoded)\n* `utf8`: Binary-encoded string (UTF8-encoded)\n* `bytes`: Byte array; an array of numbers, each representing one byte of data\n* `buffer`: A Node.js native Buffer object\n\nThe default encoding for `options.out` is a buffer (`buffer`). The input format is duck-typed if it's an Array (`bytes`) or Buffer (`buffer`) or Number object. If it's a string, it's interpreted as `binary` unless it's prefixed by `0x` (then it's `hex`). If `options.in` is set, it overrides the automatic duck-typing of the input variable.\n\n```js\nvar conv = require('binstring');\n\nconsole.dir(conv('hello', { in:'binary' })); // No output encoding specified, defaults to Buffer; output: Buffer([104,101,108,108,111])\nconsole.dir(conv([104,101,108,108,111], { out:'hex' })); // No input encoding specified, auto-detected as Byte Array; output: 68656c6c6f\nconsole.dir(conv('hello', { in:'binary', out:'hex' })); // output: 68656c6c6f\n```\n\n## Test\n\nUnit tests are written in [Mocha](http://visionmedia.github.io/mocha/). To run the test suite, checkout the git repository, and from within the base folder run:\n\n```sh\n$ npm install --dev\n$ ./node_modules/mocha/bin/mocha\n```\n\n## References on JavaScript UTF-8 forced encoding\n(these sources are also included as PDFs in the repo in case the links go dead)\n\n- http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html\n- http://hossa.in/2012/07/20/utf-8-in-javascript.html\n\n# License\n(MIT License)\n\nCopyright 2014, Brooks Boyd <boydb@midnightdesign.ws>","_attachments":{},"homepage":"https://github.com/cryptocoinjs/binstring","bugs":{"url":"https://github.com/cryptocoinjs/binstring/issues"}}