Files
bd-short-message-platform/app/middleware/utils/arrItemLength.js

8 lines
268 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 计算数组中十六进制数据的总字节数,并在最终结果中加上时间信息的4字节长度
module.exports = (arr) => {
let length = 0;
arr.forEach(element => {
length = length + (element.length / 2);
});
return length + 4;
};