New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jprochazk/cbor

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jprochazk/cbor - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

8

package.json
{
"name": "@jprochazk/cbor",
"version": "0.2.4",
"version": "0.2.5",
"description": "Partial implementation of RFC 7049 (CBOR)",

@@ -24,2 +24,3 @@ "keywords": [

"devDependencies": {
"@types/jest": "^26.0.3",
"@typescript-eslint/eslint-plugin": "^3.2.0",

@@ -32,6 +33,3 @@ "@typescript-eslint/parser": "^3.2.0",

},
"homepage": "https://github.com/jprochazk/cbor",
"dependencies": {
"@types/jest": "^26.0.3"
}
"homepage": "https://github.com/jprochazk/cbor"
}

@@ -8,11 +8,41 @@ # cbor

This library provides the [recommended API](http://cbor.io/impls.html)
### Usage
This library is meant for use in the browser, but will also work in Node.
```
> npm install @jprochazk/cbor
```
The API is very simple:
```js
import CBOR from "@jprochazk/cbor";
const json = {
"key": "value",
"another key": [
1, 2, 3
],
"number": 3.141592653589793
"nulls are also encoded": null
};
// ArrayBuffer(51)
const encoded = CBOR.encode(json);
// { "key": "value", "another key": [1, 2, 3], "number": 3.14159265359, "nulls are also encoded": null}
const decoded = CBOR.decode(encoded);
console.log(decoded.key); // value
console.log(decoded.number); // 3.1415927410125732
```
You can also encode into a pre-allocated ArrayBuffer.
```js
// Allocate a 64 byte buffer
const buffer = new ArrayBuffer(64);
// Encode the data into this buffer
const encoded = CBOR.encodeInto(data, buffer);
```
### Notes

@@ -26,4 +56,4 @@

- 16-bit float (IEEE754 binary16)
- Numbers larger than 32 bit (and BigInt)
- Integers larger than 32 bit (BigInt)
These weren't required in my case, but if you need one or more of these features, submit an [issue](https://github.com/jprochazk/cbor/issues), and I'll implement it! :)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc