code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function createBuffer (that, length) {
if (kMaxLength() < length) {
throw new RangeError('Invalid typed array length')
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = new Uint8Array(length)
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
if (that === null) {
that = new Buffer(length)
}
that.length = length
}
return that
}
|
The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a single octet.
The `Uint8Array` prototype remains unmodified.
|
createBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function Buffer (arg, encodingOrOffset, length) {
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
return new Buffer(arg, encodingOrOffset, length)
}
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new Error(
'If encoding is specified then the first argument must be a string'
)
}
return allocUnsafe(this, arg)
}
return from(this, arg, encodingOrOffset, length)
}
|
The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a single octet.
The `Uint8Array` prototype remains unmodified.
|
Buffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function from (that, value, encodingOrOffset, length) {
if (typeof value === 'number') {
throw new TypeError('"value" argument must not be a number')
}
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
return fromArrayBuffer(that, value, encodingOrOffset, length)
}
if (typeof value === 'string') {
return fromString(that, value, encodingOrOffset)
}
return fromObject(that, value)
}
|
Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
if value is a number.
Buffer.from(str[, encoding])
Buffer.from(array)
Buffer.from(buffer)
Buffer.from(arrayBuffer[, byteOffset[, length]])
|
from
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number')
} else if (size < 0) {
throw new RangeError('"size" argument must not be negative')
}
}
|
Creates a new filled Buffer instance.
alloc(size[, fill[, encoding]])
|
assertSize
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function alloc (that, size, fill, encoding) {
assertSize(size)
if (size <= 0) {
return createBuffer(that, size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string'
? createBuffer(that, size).fill(fill, encoding)
: createBuffer(that, size).fill(fill)
}
return createBuffer(that, size)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
alloc
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function allocUnsafe (that, size) {
assertSize(size)
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < size; ++i) {
that[i] = 0
}
}
return that
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
allocUnsafe
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8'
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding')
}
var length = byteLength(string, encoding) | 0
that = createBuffer(that, length)
var actual = that.write(string, encoding)
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
that = that.slice(0, actual)
}
return that
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromString
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromArrayLike (that, array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0
that = createBuffer(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromArrayLike
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromArrayBuffer (that, array, byteOffset, length) {
array.byteLength // this throws if `array` is not a valid ArrayBuffer
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('\'offset\' is out of bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('\'length\' is out of bounds')
}
if (byteOffset === undefined && length === undefined) {
array = new Uint8Array(array)
} else if (length === undefined) {
array = new Uint8Array(array, byteOffset)
} else {
array = new Uint8Array(array, byteOffset, length)
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = array
that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike(that, array)
}
return that
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromArrayBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromObject (that, obj) {
if (Buffer.isBuffer(obj)) {
var len = checked(obj.length) | 0
that = createBuffer(that, len)
if (that.length === 0) {
return that
}
obj.copy(that, 0, 0, len)
return that
}
if (obj) {
if ((typeof ArrayBuffer !== 'undefined' &&
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
if (typeof obj.length !== 'number' || isnan(obj.length)) {
return createBuffer(that, 0)
}
return fromArrayLike(that, obj)
}
if (obj.type === 'Buffer' && isArray(obj.data)) {
return fromArrayLike(that, obj.data)
}
}
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromObject
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checked (length) {
// Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength().toString(16) + ' bytes')
}
return length | 0
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checked
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function SlowBuffer (length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer.alloc(+length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
SlowBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function byteLength (string, encoding) {
if (Buffer.isBuffer(string)) {
return string.length
}
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
string = '' + string
}
var len = string.length
if (len === 0) return 0
// Use a for loop to avoid recursion
var loweredCase = false
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len
case 'utf8':
case 'utf-8':
case undefined:
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) return utf8ToBytes(string).length // assume utf8
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
byteLength
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function slowToString (encoding, start, end) {
var loweredCase = false
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if (start === undefined || start < 0) {
start = 0
}
// Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if (start > this.length) {
return ''
}
if (end === undefined || end > this.length) {
end = this.length
}
if (end <= 0) {
return ''
}
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0
start >>>= 0
if (end <= start) {
return ''
}
if (!encoding) encoding = 'utf8'
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase()
loweredCase = true
}
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
slowToString
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function swap (b, n, m) {
var i = b[n]
b[n] = b[m]
b[m] = i
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
swap
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset
byteOffset = 0
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000
}
byteOffset = +byteOffset // Coerce to Number.
if (isNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : (buffer.length - 1)
}
// Normalize byteOffset: negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
if (byteOffset >= buffer.length) {
if (dir) return -1
else byteOffset = buffer.length - 1
} else if (byteOffset < 0) {
if (dir) byteOffset = 0
else return -1
}
// Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding)
}
// Finally, search either indexOf (if dir is true) or lastIndexOf
if (Buffer.isBuffer(val)) {
// Special case: looking for empty string/buffer always fails
if (val.length === 0) {
return -1
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
} else if (typeof val === 'number') {
val = val & 0xFF // Search for a byte value [0-255]
if (Buffer.TYPED_ARRAY_SUPPORT &&
typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
}
}
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
}
throw new TypeError('val must be string, number or Buffer')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
bidirectionalIndexOf
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
var indexSize = 1
var arrLength = arr.length
var valLength = val.length
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase()
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1
}
indexSize = 2
arrLength /= 2
valLength /= 2
byteOffset /= 2
}
}
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
var i
if (dir) {
var foundIndex = -1
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex
foundIndex = -1
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
for (i = byteOffset; i >= 0; i--) {
var found = true
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false
break
}
}
if (found) return i
}
}
return -1
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
arrayIndexOf
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
read
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0
var remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
// must be an even number of digits
var strLen = string.length
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
if (length > strLen / 2) {
length = strLen / 2
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
if (isNaN(parsed)) return i
buf[offset + i] = parsed
}
return i
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hexWrite
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiWrite
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function latin1Write (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
latin1Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
ucs2Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64Slice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end)
var res = []
var i = start
while (i < end) {
var firstByte = buf[i]
var codePoint = null
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte
}
break
case 2:
secondByte = buf[i + 1]
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint
}
}
break
case 3:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint
}
}
break
case 4:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
fourthByte = buf[i + 3]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD
bytesPerSequence = 1
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
codePoint = 0xDC00 | codePoint & 0x3FF
}
res.push(codePoint)
i += bytesPerSequence
}
return decodeCodePointsArray(res)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8Slice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function decodeCodePointsArray (codePoints) {
var len = codePoints.length
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
var res = ''
var i = 0
while (i < len) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
)
}
return res
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
decodeCodePointsArray
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function asciiSlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiSlice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function latin1Slice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i])
}
return ret
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
latin1Slice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function hexSlice (buf, start, end) {
var len = buf.length
if (!start || start < 0) start = 0
if (!end || end < 0 || end > len) end = len
var out = ''
for (var i = start; i < end; ++i) {
out += toHex(buf[i])
}
return out
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hexSlice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf16leSlice (buf, start, end) {
var bytes = buf.slice(start, end)
var res = ''
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
}
return res
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf16leSlice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkOffset
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checkInt (buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkInt
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function objectWriteUInt16 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
(littleEndian ? i : 1 - i) * 8
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
objectWriteUInt16
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function objectWriteUInt32 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffffffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
objectWriteUInt32
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkIEEE754
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function writeFloat (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
}
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
writeFloat
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function writeDouble (buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
}
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
writeDouble
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64clean (str) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim(str).replace(INVALID_BASE64_RE, '')
// Node converts strings with length < 2 to ''
if (str.length < 2) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '='
}
return str
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64clean
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function stringtrim (str) {
if (str.trim) return str.trim()
return str.replace(/^\s+|\s+$/g, '')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
stringtrim
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
toHex
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf8ToBytes (string, units) {
units = units || Infinity
var codePoint
var length = string.length
var leadSurrogate = null
var bytes = []
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i)
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
}
// valid lead
leadSurrogate = codePoint
continue
}
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
leadSurrogate = codePoint
continue
}
// valid surrogate pair
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
}
leadSurrogate = null
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint)
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8ToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function asciiToBytes (str) {
var byteArray = []
for (var i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
return byteArray
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf16leToBytes (str, units) {
var c, hi, lo
var byteArray = []
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
hi = c >> 8
lo = c % 256
byteArray.push(lo)
byteArray.push(hi)
}
return byteArray
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf16leToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64ToBytes (str) {
return base64.toByteArray(base64clean(str))
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64ToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
return i
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
blitBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function isnan (val) {
return val !== val // eslint-disable-line no-self-compare
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isnan
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function createBuffer (length) {
if (length > K_MAX_LENGTH) {
throw new RangeError('The value "' + length + '" is invalid for option "size"')
}
// Return an augmented `Uint8Array` instance
var buf = new Uint8Array(length)
buf.__proto__ = Buffer.prototype
return buf
}
|
The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a single octet.
The `Uint8Array` prototype remains unmodified.
|
createBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function Buffer (arg, encodingOrOffset, length) {
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new TypeError(
'The "string" argument must be of type string. Received type number'
)
}
return allocUnsafe(arg)
}
return from(arg, encodingOrOffset, length)
}
|
The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a single octet.
The `Uint8Array` prototype remains unmodified.
|
Buffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function from (value, encodingOrOffset, length) {
if (typeof value === 'string') {
return fromString(value, encodingOrOffset)
}
if (ArrayBuffer.isView(value)) {
return fromArrayLike(value)
}
if (value == null) {
throw TypeError(
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
'or Array-like Object. Received type ' + (typeof value)
)
}
if (isInstance(value, ArrayBuffer) ||
(value && isInstance(value.buffer, ArrayBuffer))) {
return fromArrayBuffer(value, encodingOrOffset, length)
}
if (typeof value === 'number') {
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
)
}
var valueOf = value.valueOf && value.valueOf()
if (valueOf != null && valueOf !== value) {
return Buffer.from(valueOf, encodingOrOffset, length)
}
var b = fromObject(value)
if (b) return b
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
typeof value[Symbol.toPrimitive] === 'function') {
return Buffer.from(
value[Symbol.toPrimitive]('string'), encodingOrOffset, length
)
}
throw new TypeError(
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
'or Array-like Object. Received type ' + (typeof value)
)
}
|
The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a single octet.
The `Uint8Array` prototype remains unmodified.
|
from
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be of type number')
} else if (size < 0) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
}
|
Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
assertSize
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function alloc (size, fill, encoding) {
assertSize(size)
if (size <= 0) {
return createBuffer(size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string'
? createBuffer(size).fill(fill, encoding)
: createBuffer(size).fill(fill)
}
return createBuffer(size)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
alloc
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function allocUnsafe (size) {
assertSize(size)
return createBuffer(size < 0 ? 0 : checked(size) | 0)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
allocUnsafe
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromString (string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8'
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
var length = byteLength(string, encoding) | 0
var buf = createBuffer(length)
var actual = buf.write(string, encoding)
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
buf = buf.slice(0, actual)
}
return buf
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromString
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromArrayLike (array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0
var buf = createBuffer(length)
for (var i = 0; i < length; i += 1) {
buf[i] = array[i] & 255
}
return buf
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromArrayLike
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromArrayBuffer (array, byteOffset, length) {
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('"offset" is outside of buffer bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('"length" is outside of buffer bounds')
}
var buf
if (byteOffset === undefined && length === undefined) {
buf = new Uint8Array(array)
} else if (length === undefined) {
buf = new Uint8Array(array, byteOffset)
} else {
buf = new Uint8Array(array, byteOffset, length)
}
// Return an augmented `Uint8Array` instance
buf.__proto__ = Buffer.prototype
return buf
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromArrayBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function fromObject (obj) {
if (Buffer.isBuffer(obj)) {
var len = checked(obj.length) | 0
var buf = createBuffer(len)
if (buf.length === 0) {
return buf
}
obj.copy(buf, 0, 0, len)
return buf
}
if (obj.length !== undefined) {
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
return createBuffer(0)
}
return fromArrayLike(obj)
}
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
return fromArrayLike(obj.data)
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromObject
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checked (length) {
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= K_MAX_LENGTH) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
}
return length | 0
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checked
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function SlowBuffer (length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer.alloc(+length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
SlowBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function byteLength (string, encoding) {
if (Buffer.isBuffer(string)) {
return string.length
}
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
throw new TypeError(
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
'Received type ' + typeof string
)
}
var len = string.length
var mustMatch = (arguments.length > 2 && arguments[2] === true)
if (!mustMatch && len === 0) return 0
// Use a for loop to avoid recursion
var loweredCase = false
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len
case 'utf8':
case 'utf-8':
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) {
return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
}
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
byteLength
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function slowToString (encoding, start, end) {
var loweredCase = false
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if (start === undefined || start < 0) {
start = 0
}
// Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if (start > this.length) {
return ''
}
if (end === undefined || end > this.length) {
end = this.length
}
if (end <= 0) {
return ''
}
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0
start >>>= 0
if (end <= start) {
return ''
}
if (!encoding) encoding = 'utf8'
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase()
loweredCase = true
}
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
slowToString
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function swap (b, n, m) {
var i = b[n]
b[n] = b[m]
b[m] = i
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
swap
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset
byteOffset = 0
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000
}
byteOffset = +byteOffset // Coerce to Number.
if (numberIsNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : (buffer.length - 1)
}
// Normalize byteOffset: negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
if (byteOffset >= buffer.length) {
if (dir) return -1
else byteOffset = buffer.length - 1
} else if (byteOffset < 0) {
if (dir) byteOffset = 0
else return -1
}
// Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding)
}
// Finally, search either indexOf (if dir is true) or lastIndexOf
if (Buffer.isBuffer(val)) {
// Special case: looking for empty string/buffer always fails
if (val.length === 0) {
return -1
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
} else if (typeof val === 'number') {
val = val & 0xFF // Search for a byte value [0-255]
if (typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
}
}
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
}
throw new TypeError('val must be string, number or Buffer')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
bidirectionalIndexOf
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
var indexSize = 1
var arrLength = arr.length
var valLength = val.length
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase()
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1
}
indexSize = 2
arrLength /= 2
valLength /= 2
byteOffset /= 2
}
}
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
var i
if (dir) {
var foundIndex = -1
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex
foundIndex = -1
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
for (i = byteOffset; i >= 0; i--) {
var found = true
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false
break
}
}
if (found) return i
}
}
return -1
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
arrayIndexOf
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
read
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0
var remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
var strLen = string.length
if (length > strLen / 2) {
length = strLen / 2
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
if (numberIsNaN(parsed)) return i
buf[offset + i] = parsed
}
return i
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hexWrite
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiWrite
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function latin1Write (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
latin1Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
ucs2Write
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64Slice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end)
var res = []
var i = start
while (i < end) {
var firstByte = buf[i]
var codePoint = null
var bytesPerSequence = (firstByte > 0xEF) ? 4
: (firstByte > 0xDF) ? 3
: (firstByte > 0xBF) ? 2
: 1
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte
}
break
case 2:
secondByte = buf[i + 1]
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint
}
}
break
case 3:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint
}
}
break
case 4:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
fourthByte = buf[i + 3]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD
bytesPerSequence = 1
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
codePoint = 0xDC00 | codePoint & 0x3FF
}
res.push(codePoint)
i += bytesPerSequence
}
return decodeCodePointsArray(res)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8Slice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function decodeCodePointsArray (codePoints) {
var len = codePoints.length
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
var res = ''
var i = 0
while (i < len) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
)
}
return res
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
decodeCodePointsArray
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function asciiSlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiSlice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function latin1Slice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i])
}
return ret
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
latin1Slice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function hexSlice (buf, start, end) {
var len = buf.length
if (!start || start < 0) start = 0
if (!end || end < 0 || end > len) end = len
var out = ''
for (var i = start; i < end; ++i) {
out += toHex(buf[i])
}
return out
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hexSlice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf16leSlice (buf, start, end) {
var bytes = buf.slice(start, end)
var res = ''
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
}
return res
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf16leSlice
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkOffset
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checkInt (buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkInt
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkIEEE754
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function writeFloat (buf, value, offset, littleEndian, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
}
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
writeFloat
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function writeDouble (buf, value, offset, littleEndian, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
}
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
writeDouble
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64clean (str) {
// Node takes equal signs as end of the Base64 encoding
str = str.split('=')[0]
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = str.trim().replace(INVALID_BASE64_RE, '')
// Node converts strings with length < 2 to ''
if (str.length < 2) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '='
}
return str
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64clean
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
toHex
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf8ToBytes (string, units) {
units = units || Infinity
var codePoint
var length = string.length
var leadSurrogate = null
var bytes = []
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i)
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
}
// valid lead
leadSurrogate = codePoint
continue
}
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
leadSurrogate = codePoint
continue
}
// valid surrogate pair
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
}
leadSurrogate = null
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint)
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8ToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function asciiToBytes (str) {
var byteArray = []
for (var i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
return byteArray
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function utf16leToBytes (str, units) {
var c, hi, lo
var byteArray = []
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
hi = c >> 8
lo = c % 256
byteArray.push(lo)
byteArray.push(hi)
}
return byteArray
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf16leToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function base64ToBytes (str) {
return base64.toByteArray(base64clean(str))
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64ToBytes
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
return i
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
blitBuffer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function isInstance (obj, type) {
return obj instanceof type ||
(obj != null && obj.constructor != null && obj.constructor.name != null &&
obj.constructor.name === type.name)
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isInstance
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function numberIsNaN (obj) {
// For IE11 support
return obj !== obj // eslint-disable-line no-self-compare
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
numberIsNaN
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function readLacedData (reader, lacing) {
if (!lacing) return [reader.nextBuffer()]
var i, frameSize
var frames = []
var framesNum = reader.nextUInt8() + 1 // number of frames
if (lacing === FIXED_SIZE_LACING) {
// remaining data should be divisible by the number of frames
if (reader.length % framesNum !== 0) throw new Error('Fixed-Size Lacing Error')
frameSize = reader.length / framesNum
for (i = 0; i < framesNum; i++) {
frames.push(reader.nextBuffer(frameSize))
}
return frames
}
var frameSizes = []
if (lacing === XIPH_LACING) {
for (i = 0; i < framesNum - 1; i++) {
var val
frameSize = 0
do {
val = reader.nextUInt8()
frameSize += val
} while (val === 0xff)
frameSizes.push(frameSize)
}
} else if (lacing === EBML_LACING) {
// first frame
frameSize = reader.nextUIntV()
frameSizes.push(frameSize)
// middle frames
for (i = 1; i < framesNum - 1; i++) {
frameSize += reader.nextIntV()
frameSizes.push(frameSize)
}
}
for (i = 0; i < framesNum - 1; i++) {
frames.push(reader.nextBuffer(frameSizes[i]))
}
// last frame (remaining buffer)
frames.push(reader.nextBuffer())
return frames
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
readLacedData
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function BufferReader (buffer) {
this.buffer = buffer
this.offset = 0
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
BufferReader
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function EventEmitter() {
this._events = this._events || {};
this._maxListeners = this._maxListeners || undefined;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
EventEmitter
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function g() {
this.removeListener(type, g);
if (!fired) {
fired = true;
listener.apply(this, arguments);
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
g
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function isFunction(arg) {
return typeof arg === 'function';
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isFunction
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function isNumber(arg) {
return typeof arg === 'number';
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isNumber
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isObject
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
function isUndefined(arg) {
return arg === void 0;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isUndefined
|
javascript
|
muaz-khan/WebRTC-Experiment
|
Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/Chrome-Extensions/screen-recording/RecordRTC/EBML.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.