(buf, start, end)
| 1082 | } |
| 1083 | |
| 1084 | function utf16leSlice (buf, start, end) { |
| 1085 | const bytes = buf.slice(start, end) |
| 1086 | let res = '' |
| 1087 | // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) |
| 1088 | for (let i = 0; i < bytes.length - 1; i += 2) { |
| 1089 | res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) |
| 1090 | } |
| 1091 | return res |
| 1092 | } |
| 1093 | |
| 1094 | Buffer.prototype.slice = function slice (start, end) { |
| 1095 | const len = this.length |