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

bison-types

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bison-types - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

4

package.json
{
"name": "bison-types",
"version": "3.0.1",
"version": "3.0.2",
"description": "Convert between json and binary",

@@ -28,3 +28,3 @@ "main": "target/index.js",

"big.js": "~3.1.3",
"clever-buffer": "^2.0.3",
"clever-buffer": "^2.0.5",
"lodash": "^4.13.1"

@@ -31,0 +31,0 @@ },

@@ -85,2 +85,3 @@ # bison-types

* `utf-8` - utf-8 encoded string
* `latin1` - latin1 encoded string
* `bool` - boolean (stored as 8 bit integer)

@@ -188,2 +189,30 @@ * `skip` - will skip specified bytes

### Reading a string with latin1 encoding
```coffee
bison = require 'bison-types'
buf = new Buffer [0x48, 0xC9, 0x4C, 0x4C, 0x4F]
types = bison.preCompile
my-type: [
a: 'latin1(5)'
]
options = {bigEndian: false}
reader = new bison.Reader buf, types, options
myType = reader.read('my-type') # myType = { a: 'HELLO' }
```
### Reading a multi-byte string
```coffee
bison = require 'bison-types'
buf = new Buffer [0x48, 0xC3, 0x89, 0x4C, 0x4C, 0x4F]
types = bison.preCompile
my-type: [
a: 'utf-8(6)'
]
options = {bigEndian: false}
reader = new bison.Reader buf, types, options
myType = reader.read('my-type') # myType = { a: 'HÉLLO' }
```
### Complex types

@@ -286,2 +315,17 @@ The power of bison-types is evident as you define more complex types

### Writing a string with latin1 encoding
```coffee
bison = require 'bison-types'
buf = new Buffer 5
types = bison.preCompile
my-type: [
a: 'latin1'
]
options = {bigEndian: false}
writer = new bison.Writer buf, types, options
writer.write 'my-type', { a: 'HÉLLO' }
# buf will equal [0x48, 0xC9, 0x4C, 0x4C, 0x4F]
```
### Only writing a certain length of string

@@ -302,2 +346,17 @@ ```coffee

### Writing a multi-byte string
```coffee
bison = require 'bison-types'
buf = new Buffer 6
types = bison.preCompile
my-type: [
a: 'utf-8'
]
options = {bigEndian: false}
writer = new bison.Writer buf, types, options
writer.write 'my-type', { a: 'HÉLLO' }
# buf will equal [0x48, 0xC3, 0x89, 0x4C, 0x4C, 0x4F]
```
### Complex types

@@ -304,0 +363,0 @@ The power of bison-types is evident as you define more complex types

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -3,0 +3,0 @@ var _, util;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -3,0 +3,0 @@ exports.Reader = require("./reader");

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -3,0 +3,0 @@ var _, commonTypes, getTypeDefinition, typeHelper;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -3,0 +3,0 @@ var CleverBufferReader, Reader, _, preCompile, typeHelper,

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -3,0 +3,0 @@ var exp;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -68,2 +68,15 @@ module.exports = {

},
'latin1': {
_read: function(length) {
return this.buffer.getString({
length: length,
encoding: 'binary'
});
},
_write: function(val) {
return this.buffer.writeString(val, {
encoding: 'binary'
});
}
},
'utf-8': {

@@ -70,0 +83,0 @@ _read: function(length) {

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -3,0 +3,0 @@ var CleverBufferWriter, Writer, _, preCompile, typeHelper,

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