Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cbor

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cbor - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

.editorconfig

23

package.json
{
"name": "cbor",
"version": "0.0.0",
"version": "0.0.1",
"description": "NPM package for encoding and decoding CBOR (Concise Binary Object Representation) data.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha test"
},
"repository": "",
"repository": "https://github.com/dotCypress/cbor",
"keywords": [
"CBOR"
],
"author": "Vitaly Domnikov",
"license": "BSD",
"readmeFilename": "README.md"
"author": {
"name": "Vitaly Domnikov",
"email": "dotcypress@gmail.com"
},
"license": "MIT",
"readmeFilename": "README.md",
"devDependencies": {
"mocha": "~1.13.0",
"memorystream": "~0.2.0"
},
"dependencies": {
"lodash": "~2.4.1",
"node-int64": "~0.3.0"
}
}

@@ -1,4 +0,70 @@

# cbor
# cbor [![Build Status](https://secure.travis-ci.org/dotCypress/cbor.png?branch=master)](https://travis-ci.org/dotCypress/cbor)
NPM package for encoding and decoding CBOR (Concise Binary Object Representation) data. This
package implements CBOR as described in [RFC 7049](http://tools.ietf.org/html/rfc7049).
package implements CBOR as described in [RFC 7049](http://tools.ietf.org/html/rfc7049).
__Not ready for production__
## Installation
If you have npm installed, you can simply type:
```
npm install cbor
```
Or you can clone this repository using the git command:
```
git clone git://github.com/dotCypress/cbor.git
```
## Usage
Some examples how to use cbor module.
### Encode
```js
cbor.encode(value, writableStream, callback);
```
Arguments:
* ```value``` - value for encode
* ```writableStream``` - [instance of writable stream](http://nodejs.org/api/stream.html#stream_class_stream_writable)
* ```callback``` - callback function
#### Semantic encode
```js
cbor.encodeSemantic(tag, value, writableStream, callback);
```
Arguments:
* ```tag``` - semantic tag (integer)
* ```value``` - value for encode
* ```writableStream``` - [instance of writable stream](http://nodejs.org/api/stream.html#stream_class_stream_writable)
* ```callback``` - callback function
#### Samples
```js
var cbor = require("cbor");
var writableStream = ...;
var cb = ...;
// simple encoding
cbor.encode(1, writableStream, cb); // integers
cbor.encode(-50, writableStream, cb); // integers
cbor.encode(1.1, writableStream, cb); // floats
cbor.encode([123, 567, 'hello'], writableStream, cb); // arrays
cbor.encode({'a': 1, 'b': 2}, writableStream, cb); // hashes
cbor.encode(new Buffer([1,2,3,4]), writableStream, cb); // binary data
// semantic encode
cbor.encodeSemantic(0, "2013-03-21T20:04:00Z", writableStream, cb);
```
## Known issues
* All floats will be serialized only as IEEE 754 Double-Precision Float (64 bits follow)
* Encode does't support indefinite-length values.
## License
MIT
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