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.2.0 to 4.0.0

lib-es6/IOBuffer.js

30

History.md

@@ -0,1 +1,31 @@

<a name="4.0.0"></a>
# [4.0.0](https://github.com/image-js/iobuffer/compare/v3.2.0...v4.0.0) (2018-08-22)
### Bug Fixes
* fix test-travis script ([fd74496](https://github.com/image-js/iobuffer/commit/fd74496))
* remove implied undefined type from InputData ([0040962](https://github.com/image-js/iobuffer/commit/0040962))
### Chores
* remove support for Node 4 ([feabb42](https://github.com/image-js/iobuffer/commit/feabb42))
### Features
* convert to TypeScript ([b73c748](https://github.com/image-js/iobuffer/commit/b73c748))
* remove getBuffer method ([39dbc89](https://github.com/image-js/iobuffer/commit/39dbc89))
### BREAKING CHANGES
* The `getBuffer` method has been removed. Use `toArray` instead.
* The IOBuffer constructor is now a named export. Access it with
`require('iobuffer').IOBuffer` or `import { IOBuffer } from 'iobuffer'`.
* Removed support for Node 4
<a name="3.2.0"></a>

@@ -2,0 +32,0 @@ # [3.2.0](https://github.com/image-js/iobuffer/compare/v3.1.0...v3.2.0) (2016-12-27)

57

package.json
{
"name": "iobuffer",
"version": "3.2.0",
"version": "4.0.0",
"description": "Read and write binary data on ArrayBuffers",
"main": "./IOBuffer.js",
"main": "./lib/IOBuffer.js",
"module": "./lib-es6/IOBuffer.js",
"types": "./lib/IOBuffer.d.ts",
"files": [
"IOBuffer.js"
"lib",
"lib-es6"
],
"scripts": {
"eslint": "eslint IOBuffer.js test",
"eslint-fix": "npm run eslint -- --fix",
"test": "mocha --require should --reporter mocha-better-spec-reporter --recursive; npm run eslint",
"test-cov": "istanbul cover _mocha -- --require should --reporter dot --recursive",
"test-travis": "istanbul cover _mocha --report lcovonly -- --require should --reporter mocha-better-spec-reporter --recursive; npm run eslint"
"clean": "rimraf lib lib-es6",
"test": "npm run test-only && npm run tslint",
"test-coverage": "npm run test-only -- --coverage",
"test-only": "jest",
"test-travis": "npm run test-coverage && npm run tslint",
"tsc": "npm run clean && npm run tsc-es5 && npm run tsc-es6",
"tsc-es5": "tsc",
"tsc-es6": "tsc --project tsconfig.es6.json",
"tslint": "tslint --project tsconfig.base.json",
"tslint-fix": "npm run tslint -- --fix"
},

@@ -26,14 +34,31 @@ "repository": {

"homepage": "https://github.com/image-js/iobuffer#readme",
"jest": {
"testEnvironment": "node",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"devDependencies": {
"eslint": "^3.12.1",
"eslint-config-cheminfo": "^1.6.0",
"eslint-plugin-no-only-tests": "^1.1.0",
"istanbul": "^0.4.5",
"mocha": "^3.0.2",
"mocha-better-spec-reporter": "^3.0.0",
"should": "^11.1.0"
"@types/jest": "^23.3.1",
"@types/node": "^10.7.1",
"jest": "^23.5.0",
"rimraf": "^2.6.2",
"ts-jest": "^23.1.4",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"typescript": "^3.0.1"
},
"dependencies": {
"utf8": "^2.1.2"
"@types/utf8": "^2.1.6",
"utf8": "^3.0.0"
}
}
# iobuffer
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
Read and write binary data in ArrayBuffers
Read and write binary data in ArrayBuffers.
## Installation
```console
npm install iobuffer
```
$ npm install iobuffer
```
## API
Complete [API documentation](http://image-js.github.io/iobuffer/)
## Usage exemple
## Usage example
```js
const { IOBuffer } = require('iobuffer');
const io = new IOBuffer();
// Pointer offset is 0
io
.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
.setBigEndian() // Switch to big-endian mode
.writeUint32(24) // Written another 32-bit int, but big-endian, pointer offset now 19
.mark() // bookmark current pointer offset
.skip(2) // Pointer offset now 21
.writeBoolean(true) // Write 0xff, pointer offset now 22
.reset() // Go to bookmared pointer offset, pointer now 19
.setLittleEndian() // Go back to little endian mode
.writeUint16(18) // Write 16-bit unsigned integer in the previously skipped 2 bytes, pointer offset now 21
.rewind() // Pointer offset now 0
.getBuffer() // Get a DataView or Buffer (in node.js) over the written part [0-21] of the internal Buffer
io.writeChars('Hello world') // Write 11 chars, pointer offset now 11 (->15)
.writeUint32(42) // Write 32-bit int (default is little-endian), pointer offset now 15
.setBigEndian() // Switch to big-endian mode
.writeUint32(24) // Write another 32-bit int, but big-endian, pointer offset now 19
.mark() // Bookmark current pointer offset (19)
.skip(2) // Pointer offset now 21
.writeBoolean(true) // Write 0xff, pointer offset now 22
.reset() // Go to bookmarked pointer offset, pointer offset now 19
.setLittleEndian() // Go back to little endian mode
.writeUint16(18) // Write 16-bit unsigned integer in the previously skipped 2 bytes, pointer offset now 21
.rewind() // Pointer offset back to 0
.toArray(); // Get a Uint8Array over the written part [0-21] of the internal ArrayBuffer
```

@@ -40,3 +43,3 @@

[MIT](./LICENSE)
[MIT](./LICENSE)

@@ -43,0 +46,0 @@ [npm-image]: https://img.shields.io/npm/v/iobuffer.svg?style=flat-square

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