![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
JavaScript component to convert to/from strings and byte arrays.
AMD/CommonJS compatible.
This 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:
hex
: Hex-encoded string; two hexadecimal characters per bytebinary
: Binary-encoded string (ASCII-encoded)utf8
: Binary-encoded string (UTF8-encoded)bytes
: Byte array; an array of numbers, each representing one byte of databuffer
: A Node.js native Buffer objectThe 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.
var conv = require('binstring');
console.dir(conv('hello', { in:'binary' })); // No output encoding specified, defaults to Buffer; output: Buffer([104,101,108,108,111])
console.dir(conv([104,101,108,108,111], { out:'hex' })); // No input encoding specified, auto-detected as Byte Array; output: 68656c6c6f
console.dir(conv('hello', { in:'binary', out:'hex' })); // output: 68656c6c6f
Unit tests are written in Mocha. To run the test suite, checkout the git repository, and from within the base folder run:
$ npm install --dev
$ ./node_modules/mocha/bin/mocha
(these sources are also included as PDFs in the repo in case the links go dead)
(MIT License)
Copyright 2014, Brooks Boyd boydb@midnightdesign.ws
FAQs
Convert binary data to and from various string representations
The npm package binstring receives a total of 654 weekly downloads. As such, binstring popularity was classified as not popular.
We found that binstring demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.