from-unsigned-int32

2.0.0 • Public • Published

js-standard-style

convert 32 bit buffer (size 4 byte) to number (base 10).

Currently only support big endian.

Also checkout to-unsigned-int32

Install

npm i from-unsigned-int32

API

  1. Async API
var fromUInt32 = require('from-unsigned-int32')
 
fromUInt32(buffr /*<Buffer 00 20 00 00 00 00 00 0c>*/, 4, function (err, res) {
    console.log(res) //12
})
 

buffr should be Buffer.

offset this is optional parameter default is 0.

callback get two arguments:

  1. An error object.

  2. number (base 10).

  3. Sync API

var fromUInt32 = require('from-unsigned-int32')
 
console.log(fromUInt32.fromUInt32Sync(buffr /*<Buffer 00 20 00 00 00 00 00 0c>*/), 4)  //12
 

buffr should be Buffer.

offset this is optional parameter default is 0.

returns integer

licence

MIT

Readme

Keywords

Package Sidebar

Install

npm i from-unsigned-int32

Weekly Downloads

1

Version

2.0.0

License

MIT

Last publish

Collaborators

  • ichetandhembre