Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
The Concise Binary Object Representation (CBOR) data format (RFC7049) implemented in pure JavaScript.
The Concise Binary Object Representation (CBOR) data format (RFC 7049) implemented in pure JavaScript.
The CBOR
-object provides the following two functions:
CBOR.decode(data)
Take the ArrayBuffer object data and return it decoded as a JavaScript object.
CBOR.encode(data)
Take the JavaScript object data and return it encoded as a ArrayBuffer object.
Include cbor.js
in your or HTML page:
<script src="path/to/cbor.js" type="text/javascript"></script>
Then you can use it via the CBOR
-object in your code:
var initial = { Hello: "World" };
var encoded = CBOR.encode(initial);
var decoded = CBOR.decode(encoded);
After running this example initial
and decoded
represent the same value.
The API was designed to play well with the WebSocket
object in the browser:
var websocket = new WebSocket(url);
websocket.binaryType = "arraybuffer";
...
websocket.onmessage = function(event) {
var message = CBOR.decode(event.data);
};
...
websocket.send(CBOR.encode(message));
FAQs
The Concise Binary Object Representation (CBOR) data format (RFC7049) implemented in pure JavaScript.
The npm package cbor-js receives a total of 179,838 weekly downloads. As such, cbor-js popularity was classified as popular.
We found that cbor-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.