e-arraybuffer-base64 (英语) 
符合ES谱的Shim/polyfer/替换ArrayBuffer基数64方法,最多可达ES3
此软件包执行 希姆・API “多”接口。 它在ES3支持的环境中工作并遵守 光谱。 。 。 .
因为 Iterator.prototype 方法取决于接收器( this 值,每个子目录中的主导出将字符串作为第一个参数来操作.
软件包本身的主要导出只是一组可用的目录名. 仅此而已.
若为 Uint8Array 不存在 shim 函数和 auto 进入点将是一个不开放.
支持的东西
Uint8Array.fromBase64Uint8Array.fromHexUint8Array.prototype.toBase64Uint8Array.prototype.toHexUint8Array.prototype.setFromBase64Uint8Array.prototype.setFromHex
当你需要这个包的时候
- 当您使用不支持上述任何方法的引擎时
- 当使用 Safari 18.5 或更早时, 它不能丢入奇长的六角弦
开始
npm install --save es-arraybuffer-base64
使用/实例
const fromHex = require('es-arraybuffer-base64/Uint8Array.fromHex');
const toHex = require('es-arraybuffer-base64/Uint8Array.prototype.toHex');
const assert = require('assert');
const array = new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]);
const hex = '48656c6c6f20576f726c64';
assert.deepEqual(fromHex(hex), array);
assert.equal(toHex(array), hex);
require('./auto'); // shim all of the methods
require('./Uint8Array.fromHex/auto'); // shim the “fromHex” method
测试
仅仅复制回转, npm install运行 npm test
