@chengaoyuan/int64

int64的序列化与反序列化

Usage no npm install needed!

<script type="module">
  import chengaoyuanInt64 from 'https://cdn.skypack.dev/@chengaoyuan/int64';
</script>

README

int64

npm version install size NPM Downloads Build Status Coverage Status

Installation

$ npm install @chengaoyuan/int64

Usage

import { setInt64, setUint64, getInt64, getUint64 } from "@chengaoyuan/int64";
const ab = new ArrayBuffer(8);
const dv = new DataView(ab);

setInt64(dv, 0, 1234567890, false);
console.log(getInt64(dv, 0, false)); // out: 1234567890

setInt64(dv, 0, -1234567890, true);
console.log(getInt64(dv, 0, true)); // out: -1234567890

setUint64(dv, 0, 1234567890, false);
console.log(getUint64(dv, 0, false)); // out: 1234567890

Testing

$ npm test