Files
bare-operating-system/packages/bare-os-openssh/vendor/bare-ssh2/lib/buffer-polyfill.js
T

34 lines
907 B
JavaScript

'use strict'
const B = Buffer
if (typeof B.prototype.utf8Write !== 'function') {
B.prototype.utf8Write = function utf8Write(string, offset, length) {
return this.write(string, offset, length, 'utf8')
}
}
if (typeof B.prototype.latin1Write !== 'function') {
B.prototype.latin1Write = function latin1Write(string, offset, length) {
return this.write(string, offset, length, 'latin1')
}
}
if (typeof B.prototype.base64Slice !== 'function') {
B.prototype.base64Slice = function base64Slice(start, end) {
return this.toString('base64', start, end)
}
}
if (typeof B.prototype.utf8Slice !== 'function') {
B.prototype.utf8Slice = function utf8Slice(start, end) {
return this.toString('utf8', start, end)
}
}
if (typeof B.prototype.latin1Slice !== 'function') {
B.prototype.latin1Slice = function latin1Slice(start, end) {
return this.toString('latin1', start, end)
}
}