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

iobuffer

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobuffer - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

10

History.md

@@ -0,1 +1,11 @@

<a name="3.2.0"></a>
# [3.2.0](https://github.com/image-js/iobuffer/compare/v3.1.0...v3.2.0) (2016-12-27)
### Features
* add readUtf8 and writeUtf8 ([6118a54](https://github.com/image-js/iobuffer/commit/6118a54)), closes [#31](https://github.com/image-js/iobuffer/issues/31)
<a name="3.1.0"></a>

@@ -2,0 +12,0 @@ # [3.1.0](https://github.com/image-js/iobuffer/compare/v3.0.0...v3.1.0) (2016-12-15)

'use strict';
const utf8 = require('utf8');
const defaultByteLength = 1024 * 8;

@@ -329,2 +331,13 @@ const charArray = [];

/**
* Read the next n bytes, return a UTF-8 decoded string and move pointer forward
* @param {number} n
* @return {string}
*/
readUtf8(n) {
if (n === undefined) n = 1;
const bString = this.readChars(n);
return utf8.decode(bString);
}
/**
* Write 0xff if the passed value is truthy, 0x00 otherwise

@@ -486,2 +499,12 @@ * @param {any} value

/**
* UTF-8 encode and write the passed string to the current pointer offset
* @param {string} str
* @return {IOBuffer}
*/
writeUtf8(str) {
const bString = utf8.encode(str);
return this.writeChars(bString);
}
/**
* Export a Uint8Array view of the internal buffer.

@@ -488,0 +511,0 @@ * The view starts at the byte offset and its length

5

package.json
{
"name": "iobuffer",
"version": "3.1.0",
"version": "3.2.0",
"description": "Read and write binary data on ArrayBuffers",

@@ -34,3 +34,6 @@ "main": "./IOBuffer.js",

"should": "^11.1.0"
},
"dependencies": {
"utf8": "^2.1.2"
}
}

6

README.md

@@ -24,3 +24,3 @@ # iobuffer

io
.writeChars('Hello world') // Written 11 chars, pointer offset now 11
.writeChars('Hello world') // Written 11 chars, pointer offset now 11 (->15)
.writeUint32(42) // Written 32-bit int (default is little-endian), pointer offset now 15

@@ -36,5 +36,3 @@ .setBigEndian() // Switch to big-endian mode

.rewind() // Pointer offset now 0
.toArray() // Create a DataView of the internal Buffer that ranges over the written buffer [0-21]
.getBuffer() // Get a DataView or Buffer (in node.js) over the written part [0-21] of the internal Buffer
```

@@ -41,0 +39,0 @@

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