@ecency/bytebuffer

中文文档
6.0.0发布于 2024/08/07Apache-2.0CommonJS近 30 天下载 7357

The swiss army knife for binary data in JavaScript.

原始使用文档
文档目录8 节
  1. Fork Notes:
  2. Features
  3. Usage
  4. API
  5. Downloads
  6. Support for IE<10, FF<15, Chrome<9 etc.
  7. Contributors
  8. License

Fork Notes:

  • Based off of upstream master instead of upstream latest release, because tests were broken on the latest release.
  • Removed new Buffer() usage.
  • Dropped super old Node version support to use Buffer.alloc/Buffer.from.
  • Removed minified/gzipped builds.
  • Added files to package.json for smaller package size.

bytebuffer.js - The swiss army knife for binary data in JavaScript.

A fast and complete ByteBuffer implementation using either ArrayBuffers in the browser or node Buffers under node.js, generated from a single source tree through MetaScript.

Build Status Donate

Features

  • Three API-compatible versions:
    • bytebuffer   Backing buffer: ArrayBuffer, Accessor: Uint8Array
    • bytebuffer-dataview   Backing buffer: ArrayBuffer, Accessor: DataView
    • bytebuffer-node   Backing buffer / Accessor: node Buffer
  • 8, 16, 32 and 64 bit (through long.js) signed and unsigned integers
  • 32 and 64 bit floats
  • Varints as used in protobuf (32 and 64 bit, zig-zag)
  • Base64, utf8, binary, hex and debug encodings
  • Handy string and debugging utilities
  • Big and little endianness
  • Relative and absolute zero-copy operations wherever possible
  • Transparent resizing when using unknown-length data
  • Chaining of all operations that do not return a specific value
  • Slicing, appending, prepending, reversing, flip, mark, reset, etc.

Usage

The library is compatible with CommonJS and AMD loaders and is exposed globally as dcodeIO.ByteBuffer if neither is available.

var ByteBuffer = require("bytebuffer");

var bb = new ByteBuffer()
            .writeIString("Hello world!")
            .flip();
console.log(bb.readIString()+" from bytebuffer.js");

In the browser, 64 bit integer support is optional and present only if Long.js has been loaded prior to bytebuffer.js.

API

Downloads

Support for IE<10, FF<15, Chrome<9 etc.

  • Use bytebuffer-dataview with a polyfill (see)

Contributors

Dretch (IE8 compatibility)

License

License: Apache License, Version 2.0 - Logo derived from W3C HTML5 Logos (CC A 3.0)

版本与发布记录

@ecency/bytebuffer 共发布 1 个版本,首次发布于 2024/08/07;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.0.0latest2024/08/072 年前

关于 @ecency/bytebuffer 的常见问题

@ecency/bytebuffer 是什么?

The swiss army knife for binary data in JavaScript.

如何安装 @ecency/bytebuffer?

在项目目录运行 npm install @ecency/bytebuffer,或使用 pnpm add / yarn add / bun add。

@ecency/bytebuffer 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ecency__bytebuffer 是否存在。

@ecency/bytebuffer 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@ecency/bytebuffer 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=6。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ecency/bytebuffer 可以商用吗?

@ecency/bytebuffer 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@ecency/bytebuffer 的下载量有多少?

根据 npm 官方下载统计,@ecency/bytebuffer 在 2026/10/13 – 2026/11/11 这 30 天内被下载 7,357 次,日均约 245 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ecency/bytebuffer 还在维护吗?

最新版本 6.0.0 发布于 2024/08/07(2 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/08/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。