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 parseRIFF(string) { var offset = 0; var chunks = {}; while (offset < string.length) { var id = string.substr(offset, 4); var len = getStrLength(string, offset); var data = string.substr(offset + 4 + 4, len); of...
Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder. @method @memberof Whammy @example recorder = new Whammy().Video(0.8, 100); recorder.add(canvas || context || 'image/webp'); @param {string} frame - Canvas || Context || image/webp @param {number} duration - Stick a duration (in milliseconds)
parseRIFF
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/dev/Whammy.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js
MIT
function doubleToString(num) { return [].slice.call( new Uint8Array((new Float64Array([num])).buffer), 0).map(function(e) { return String.fromCharCode(e); }).reverse().join(''); }
Pass Canvas or Context or image/webp(string) to {@link Whammy} encoder. @method @memberof Whammy @example recorder = new Whammy().Video(0.8, 100); recorder.add(canvas || context || 'image/webp'); @param {string} frame - Canvas || Context || image/webp @param {number} duration - Stick a duration (in milliseconds)
doubleToString
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/dev/Whammy.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/Whammy.js
MIT
function drawFrames(frameInterval) { frameInterval = typeof frameInterval !== 'undefined' ? frameInterval : 10; var duration = new Date().getTime() - lastTime; if (!duration) { return setTimeout(drawFrames, frameInterval, frameInterval); } if (isPausedRecording) { ...
Draw and push frames to Whammy @param {integer} frameInterval - set minimum interval (in milliseconds) between each time we push a frame to Whammy
drawFrames
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/dev/WhammyRecorder.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/WhammyRecorder.js
MIT
function asyncLoop(o) { var i = -1, length = o.length; (function loop() { i++; if (i === length) { o.callback(); return; } // "setTimeout" added by Jim McLeod setTimeout(function() { ...
Draw and push frames to Whammy @param {integer} frameInterval - set minimum interval (in milliseconds) between each time we push a frame to Whammy
asyncLoop
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/dev/WhammyRecorder.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/WhammyRecorder.js
MIT
function dropBlackFrames(_frames, _framesToCheck, _pixTolerance, _frameTolerance, callback) { var localCanvas = document.createElement('canvas'); localCanvas.width = canvas.width; localCanvas.height = canvas.height; var context2d = localCanvas.getContext('2d'); var resultFrames =...
remove black frames from the beginning to the specified frame @param {Array} _frames - array of frames to be checked @param {number} _framesToCheck - number of frame until check will be executed (-1 - will drop all frames until frame not matched will be found) @param {number} _pixTolerance - 0 - very strict (only black...
dropBlackFrames
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/dev/WhammyRecorder.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/WhammyRecorder.js
MIT
finishImage = function() { if (!doNotCheckNext && maxPixCount - matchPixCount <= maxPixCount * frameTolerance) { // console.log('removed black frame : ' + f + ' ; frame duration ' + _frames[f].duration); } else { // console.log('fra...
remove black frames from the beginning to the specified frame @param {Array} _frames - array of frames to be checked @param {number} _framesToCheck - number of frame until check will be executed (-1 - will drop all frames until frame not matched will be found) @param {number} _pixTolerance - 0 - very strict (only black...
finishImage
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/dev/WhammyRecorder.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/WhammyRecorder.js
MIT
function clearRecordedDataCB() { whammy.frames = []; isStopDrawing = true; isPausedRecording = false; }
This method resets currently recorded data. @method @memberof WhammyRecorder @example recorder.clearRecordedData();
clearRecordedDataCB
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/dev/WhammyRecorder.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/dev/WhammyRecorder.js
MIT
function makeMetadataSeekable(originalMetadata, duration, cuesInfo) { // extract the header, we can reuse this as-is var header = extractElement("EBML", originalMetadata); var headerSize = encodedSizeOfEbml(header); //console.error("Header size: " + headerSize); //printElementIds(header); // Aft...
convert the metadata from a streaming webm bytestream to a seekable file by inserting Duration, Seekhead and Cues @param originalMetadata - orginal metadata (everything before the clusters start) from media recorder @param duration - Duration (TimecodeScale) @param cues - cue points for clusters
makeMetadataSeekable
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/EBML.js
MIT
_loop_1 = function (i) { // SeekHead starts at 0 var infoStart = seekHeadSize; // Info comes directly after SeekHead var tracksStart = infoStart + infoSize; // Tracks comes directly after Info var cuesStart = tracksStart + tracksSize; // Cues starts directly after var newMetadat...
convert the metadata from a streaming webm bytestream to a seekable file by inserting Duration, Seekhead and Cues @param originalMetadata - orginal metadata (everything before the clusters start) from media recorder @param duration - Duration (TimecodeScale) @param cues - cue points for clusters
_loop_1
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/EBML.js
MIT
function removeElement(idName, metadata) { var result = []; var start = -1; for (var i = 0; i < metadata.length; i++) { var element = metadata[i]; if (element.name === idName) { // if it's a Master element, extract the start and end element, and everything in between ...
remove all occurances of an EBML element from an array of elements If it's a MasterElement you will also remove the content. (everything between start and end) @param idName - name of the EBML Element to remove. @param metadata - array of EBML elements to search
removeElement
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/EBML.js
MIT
function extractElement(idName, metadata) { var result = []; var start = -1; for (var i = 0; i < metadata.length; i++) { var element = metadata[i]; if (element.name === idName) { // if it's a Master element, extract the start and end element, and everything in between ...
extract the first occurance of an EBML tag from a flattened array of EBML data. If it's a MasterElement you will also get the content. (everything between start and end) @param idName - name of the EBML Element to extract. @param metadata - array of EBML elements to search
extractElement
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/EBML.js
MIT
function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff }
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...
kMaxLength
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/EBML.js
MIT
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 { ...
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...
createBuffer
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 ...
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...
Buffer
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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...
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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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. r...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
alloc
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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, ...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
fromString
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
fromArrayBuffer
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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.buffe...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
fromObject
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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()....
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
checked
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 !== '...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
byteLength
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 ...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
slowToString
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 = 0x7fffff...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
bidirectionalIndexOf
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 ===...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
arrayIndexOf
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 = str...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
hexWrite
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 + bytesPer...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
utf8Slice
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 += Strin...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
decodeCodePointsArray
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
base64clean
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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) { ...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
utf8ToBytes
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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...
createBuffer
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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, en...
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...
Buffer
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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, Array...
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...
from
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
alloc
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 ...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
fromString
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 i...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
fromArrayBuffer
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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(ob...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
fromObject
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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....
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
checked
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 str...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
byteLength
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 ...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
slowToString
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 = 0x7fffff...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
bidirectionalIndexOf
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 ===...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
arrayIndexOf
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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)...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
hexWrite
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 + by...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
utf8Slice
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 += Strin...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
decodeCodePointsArray
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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 ...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
base64clean
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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) { ...
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
utf8ToBytes
javascript
muaz-khan/WebRTC-Experiment
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/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
RecordRTC/libs/EBML.js
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RecordRTC/libs/EBML.js
MIT