我在node.js上做的这个程序,有异常。当我进行 decodeAllSync 时,我得到一个十进制数字的向量,它的数字比通过使用 encodeAsync 重新转换向量得到的数字少一个。为什么我没有得到相同的向量?谢谢
const cbor = require('cbor');
...
const results = cbor.decodeAllSync(output);
const input = cbor.encodeAsync(results);
console.log(output);
input.then(
function (x) {
var v=new Uint8Array(x);
console.log(v);
},
function () {
console.log("fail ");
});
我收到输入的打印输出:
Uint8Array [
129,
210,
132,
77,
...
我收到输出的打印输出:
Uint8Array [
210,
132,
77,
...