Tons of Solutions Engineering work done today for the rest of the CS team! Headway, Howard Hanna, Engels, Brighton, etc. Also completed Datasnippers auth flow and worked on Anthology's script. Cloned Anthology's courses (900..) and will clone Full Story on Monday.
This commit is contained in:
15
Scripts/node_modules/b4a/LICENSE
generated
vendored
Normal file
15
Scripts/node_modules/b4a/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2021 Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
145
Scripts/node_modules/b4a/README.md
generated
vendored
Normal file
145
Scripts/node_modules/b4a/README.md
generated
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
# Buffer for Array
|
||||
|
||||
Buffer for Array (B4A) provides a set of functions for bridging the gap between the Node.js `Buffer` class and the `Uint8Array` class. A browser compatibility layer is also included, making it possible to use B4A in both Node.js and browsers without having to worry about whether you're dealing with buffers or typed arrays.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install b4a
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
#### `b4a.isBuffer(value)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferisbufferobj
|
||||
|
||||
This will also return `true` when passed a `Uint8Array`.
|
||||
|
||||
#### `b4a.isEncoding(encoding)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferisencodingencoding
|
||||
|
||||
#### `b4a.alloc(size[, fill[, encoding]])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferallocsize-fill-encoding
|
||||
|
||||
#### `b4a.allocUnsafe(size)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferallocunsafesize
|
||||
|
||||
#### `b4a.allocUnsafeSlow(size)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferallocunsafeslowsize
|
||||
|
||||
#### `b4a.byteLength(string)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferbytelengthstring-encoding
|
||||
|
||||
#### `b4a.compare(buf1, buf2)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-buffercomparebuf1-buf2
|
||||
|
||||
#### `b4a.concat(buffers[, totalLength])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferconcatlist-totallength
|
||||
|
||||
#### `b4a.copy(source, target[, targetStart[, sourceStart[, sourceEnd]]])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufcopytarget-targetstart-sourcestart-sourceend
|
||||
|
||||
#### `b4a.equals(buf1, buf2)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufequalsotherbuffer
|
||||
|
||||
#### `b4a.fill(buffer, value[, offset[, end]][, encoding])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#buffillvalue-offset-end-encoding
|
||||
|
||||
#### `b4a.from(array)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferfromarray
|
||||
|
||||
#### `b4a.from(arrayBuffer[, byteOffset[, length]])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferfromarraybuffer-byteoffset-length
|
||||
|
||||
#### `b4a.from(buffer)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferfrombuffer
|
||||
|
||||
#### `b4a.from(string[, encoding])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#static-method-bufferfromstring-encoding
|
||||
|
||||
#### `b4a.includes(buffer, value[, byteOffset][, encoding])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufincludesvalue-byteoffset-encoding
|
||||
|
||||
#### `b4a.indexOf(buffer, value[, byteOffset][, encoding])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufindexofvalue-byteoffset-encoding
|
||||
|
||||
#### `b4a.lastIndexOf(buffer, value[, byteOffset][, encoding])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#buflastindexofvalue-byteoffset-encoding
|
||||
|
||||
#### `b4a.swap16(buffer)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufswap16
|
||||
|
||||
#### `b4a.swap32(buffer)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufswap32
|
||||
|
||||
#### `b4a.swap64(buffer)`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufswap64
|
||||
|
||||
#### `b4a.toBuffer(buffer)`
|
||||
|
||||
Convert a buffer to its canonical representation. In Node.js, the canonical representation is a `Buffer`. In the browser, the canonical representation is a `Uint8Array`.
|
||||
|
||||
#### `b4a.toString(buffer, [encoding[, start[, end]]])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#buftostringencoding-start-end
|
||||
|
||||
#### `b4a.write(buffer, string[, offset[, length]][, encoding])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufwritestring-offset-length-encoding
|
||||
|
||||
#### `b4a.writeDoubleLE(buffer, value[, offset])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufwritedoublelevalue-offset
|
||||
|
||||
#### `b4a.writeFloatLE(buffer, value[, offset])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufwritefloatlevalue-offset
|
||||
|
||||
#### `b4a.writeUInt32LE(buffer, value[, offset])`
|
||||
|
||||
https://nodejs.org/api/buffer.html#bufwriteuint32levalue-offset
|
||||
|
||||
#### `b4a.writeInt32LE(buffer, value[, offset])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufwriteint32levalue-offset
|
||||
|
||||
#### `b4a.readDoubleLE(buffer[, offset])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufreaddoubleleoffset
|
||||
|
||||
#### `b4a.readFloatLE(buffer[, offset])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufreadfloatleoffset
|
||||
|
||||
#### `b4a.readUInt32LE(buffer[, offset])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufreaduint32leoffset
|
||||
|
||||
#### `b4a.readInt32LE(buffer[, offset])`
|
||||
|
||||
See https://nodejs.org/api/buffer.html#bufreadint32leoffset
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
499
Scripts/node_modules/b4a/browser.js
generated
vendored
Normal file
499
Scripts/node_modules/b4a/browser.js
generated
vendored
Normal file
@ -0,0 +1,499 @@
|
||||
const ascii = require('./lib/ascii')
|
||||
const base64 = require('./lib/base64')
|
||||
const hex = require('./lib/hex')
|
||||
const utf8 = require('./lib/utf8')
|
||||
const utf16le = require('./lib/utf16le')
|
||||
|
||||
const LE = new Uint8Array(Uint16Array.of(0xff).buffer)[0] === 0xff
|
||||
|
||||
function codecFor (encoding) {
|
||||
switch (encoding) {
|
||||
case 'ascii':
|
||||
return ascii
|
||||
case 'base64':
|
||||
return base64
|
||||
case 'hex':
|
||||
return hex
|
||||
case 'utf8':
|
||||
case 'utf-8':
|
||||
case undefined:
|
||||
return utf8
|
||||
case 'ucs2':
|
||||
case 'ucs-2':
|
||||
case 'utf16le':
|
||||
case 'utf-16le':
|
||||
return utf16le
|
||||
default:
|
||||
throw new Error(`Unknown encoding: ${encoding}`)
|
||||
}
|
||||
}
|
||||
|
||||
function isBuffer (value) {
|
||||
return value instanceof Uint8Array
|
||||
}
|
||||
|
||||
function isEncoding (encoding) {
|
||||
try {
|
||||
codecFor(encoding)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function alloc (size, fill, encoding) {
|
||||
const buffer = new Uint8Array(size)
|
||||
if (fill !== undefined) exports.fill(buffer, fill, 0, buffer.byteLength, encoding)
|
||||
return buffer
|
||||
}
|
||||
|
||||
function allocUnsafe (size) {
|
||||
return new Uint8Array(size)
|
||||
}
|
||||
|
||||
function allocUnsafeSlow (size) {
|
||||
return new Uint8Array(size)
|
||||
}
|
||||
|
||||
function byteLength (string, encoding) {
|
||||
return codecFor(encoding).byteLength(string)
|
||||
}
|
||||
|
||||
function compare (a, b) {
|
||||
if (a === b) return 0
|
||||
|
||||
const len = Math.min(a.byteLength, b.byteLength)
|
||||
|
||||
a = new DataView(a.buffer, a.byteOffset, a.byteLength)
|
||||
b = new DataView(b.buffer, b.byteOffset, b.byteLength)
|
||||
|
||||
let i = 0
|
||||
|
||||
for (let n = len - (len % 4); i < n; i += 4) {
|
||||
const x = a.getUint32(i, LE)
|
||||
const y = b.getUint32(i, LE)
|
||||
if (x !== y) break
|
||||
}
|
||||
|
||||
for (; i < len; i++) {
|
||||
const x = a.getUint8(i)
|
||||
const y = b.getUint8(i)
|
||||
if (x < y) return -1
|
||||
if (x > y) return 1
|
||||
}
|
||||
|
||||
return a.byteLength > b.byteLength ? 1 : a.byteLength < b.byteLength ? -1 : 0
|
||||
}
|
||||
|
||||
function concat (buffers, totalLength) {
|
||||
if (totalLength === undefined) {
|
||||
totalLength = buffers.reduce((len, buffer) => len + buffer.byteLength, 0)
|
||||
}
|
||||
|
||||
const result = new Uint8Array(totalLength)
|
||||
|
||||
let offset = 0
|
||||
for (const buffer of buffers) {
|
||||
if (offset + buffer.byteLength > result.byteLength) {
|
||||
const sub = buffer.subarray(0, result.byteLength - offset)
|
||||
result.set(sub, offset)
|
||||
return result
|
||||
}
|
||||
result.set(buffer, offset)
|
||||
offset += buffer.byteLength
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function copy (source, target, targetStart = 0, start = 0, end = source.byteLength) {
|
||||
if (end > 0 && end < start) return 0
|
||||
if (end === start) return 0
|
||||
if (source.byteLength === 0 || target.byteLength === 0) return 0
|
||||
|
||||
if (targetStart < 0) throw new RangeError('targetStart is out of range')
|
||||
if (start < 0 || start >= source.byteLength) throw new RangeError('sourceStart is out of range')
|
||||
if (end < 0) throw new RangeError('sourceEnd is out of range')
|
||||
|
||||
if (targetStart >= target.byteLength) targetStart = target.byteLength
|
||||
if (end > source.byteLength) end = source.byteLength
|
||||
if (target.byteLength - targetStart < end - start) {
|
||||
end = target.length - targetStart + start
|
||||
}
|
||||
|
||||
const len = end - start
|
||||
|
||||
if (source === target) {
|
||||
target.copyWithin(targetStart, start, end)
|
||||
} else {
|
||||
target.set(source.subarray(start, end), targetStart)
|
||||
}
|
||||
|
||||
return len
|
||||
}
|
||||
|
||||
function equals (a, b) {
|
||||
if (a === b) return true
|
||||
if (a.byteLength !== b.byteLength) return false
|
||||
|
||||
const len = a.byteLength
|
||||
|
||||
a = new DataView(a.buffer, a.byteOffset, a.byteLength)
|
||||
b = new DataView(b.buffer, b.byteOffset, b.byteLength)
|
||||
|
||||
let i = 0
|
||||
|
||||
for (let n = len - (len % 4); i < n; i += 4) {
|
||||
if (a.getUint32(i, LE) !== b.getUint32(i, LE)) return false
|
||||
}
|
||||
|
||||
for (; i < len; i++) {
|
||||
if (a.getUint8(i) !== b.getUint8(i)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function fill (buffer, value, offset, end, encoding) {
|
||||
if (typeof value === 'string') {
|
||||
// fill(buffer, string, encoding)
|
||||
if (typeof offset === 'string') {
|
||||
encoding = offset
|
||||
offset = 0
|
||||
end = buffer.byteLength
|
||||
|
||||
// fill(buffer, string, offset, encoding)
|
||||
} else if (typeof end === 'string') {
|
||||
encoding = end
|
||||
end = buffer.byteLength
|
||||
}
|
||||
} else if (typeof value === 'number') {
|
||||
value = value & 0xff
|
||||
} else if (typeof value === 'boolean') {
|
||||
value = +value
|
||||
}
|
||||
|
||||
if (offset < 0 || buffer.byteLength < offset || buffer.byteLength < end) {
|
||||
throw new RangeError('Out of range index')
|
||||
}
|
||||
|
||||
if (offset === undefined) offset = 0
|
||||
if (end === undefined) end = buffer.byteLength
|
||||
|
||||
if (end <= offset) return buffer
|
||||
|
||||
if (!value) value = 0
|
||||
|
||||
if (typeof value === 'number') {
|
||||
for (let i = offset; i < end; ++i) {
|
||||
buffer[i] = value
|
||||
}
|
||||
} else {
|
||||
value = isBuffer(value) ? value : from(value, encoding)
|
||||
|
||||
const len = value.byteLength
|
||||
|
||||
for (let i = 0; i < end - offset; ++i) {
|
||||
buffer[i + offset] = value[i % len]
|
||||
}
|
||||
}
|
||||
|
||||
return buffer
|
||||
}
|
||||
|
||||
function from (value, encodingOrOffset, length) {
|
||||
// from(string, encoding)
|
||||
if (typeof value === 'string') return fromString(value, encodingOrOffset)
|
||||
|
||||
// from(array)
|
||||
if (Array.isArray(value)) return fromArray(value)
|
||||
|
||||
// from(buffer)
|
||||
if (ArrayBuffer.isView(value)) return fromBuffer(value)
|
||||
|
||||
// from(arrayBuffer[, byteOffset[, length]])
|
||||
return fromArrayBuffer(value, encodingOrOffset, length)
|
||||
}
|
||||
|
||||
function fromString (string, encoding) {
|
||||
const codec = codecFor(encoding)
|
||||
const buffer = new Uint8Array(codec.byteLength(string))
|
||||
codec.write(buffer, string, 0, buffer.byteLength)
|
||||
return buffer
|
||||
}
|
||||
|
||||
function fromArray (array) {
|
||||
const buffer = new Uint8Array(array.length)
|
||||
buffer.set(array)
|
||||
return buffer
|
||||
}
|
||||
|
||||
function fromBuffer (buffer) {
|
||||
const copy = new Uint8Array(buffer.byteLength)
|
||||
copy.set(buffer)
|
||||
return copy
|
||||
}
|
||||
|
||||
function fromArrayBuffer (arrayBuffer, byteOffset, length) {
|
||||
return new Uint8Array(arrayBuffer, byteOffset, length)
|
||||
}
|
||||
|
||||
function includes (buffer, value, byteOffset, encoding) {
|
||||
return indexOf(buffer, value, byteOffset, encoding) !== -1
|
||||
}
|
||||
|
||||
function bidirectionalIndexOf (buffer, value, byteOffset, encoding, first) {
|
||||
if (buffer.byteLength === 0) return -1
|
||||
|
||||
if (typeof byteOffset === 'string') {
|
||||
encoding = byteOffset
|
||||
byteOffset = 0
|
||||
} else if (byteOffset === undefined) {
|
||||
byteOffset = first ? 0 : (buffer.length - 1)
|
||||
} else if (byteOffset < 0) {
|
||||
byteOffset += buffer.byteLength
|
||||
}
|
||||
|
||||
if (byteOffset >= buffer.byteLength) {
|
||||
if (first) return -1
|
||||
else byteOffset = buffer.byteLength - 1
|
||||
} else if (byteOffset < 0) {
|
||||
if (first) byteOffset = 0
|
||||
else return -1
|
||||
}
|
||||
|
||||
if (typeof value === 'string') {
|
||||
value = from(value, encoding)
|
||||
} else if (typeof value === 'number') {
|
||||
value = value & 0xff
|
||||
|
||||
if (first) {
|
||||
return buffer.indexOf(value, byteOffset)
|
||||
} else {
|
||||
return buffer.lastIndexOf(value, byteOffset)
|
||||
}
|
||||
}
|
||||
|
||||
if (value.byteLength === 0) return -1
|
||||
|
||||
if (first) {
|
||||
let foundIndex = -1
|
||||
|
||||
for (let i = byteOffset; i < buffer.byteLength; i++) {
|
||||
if (buffer[i] === value[foundIndex === -1 ? 0 : i - foundIndex]) {
|
||||
if (foundIndex === -1) foundIndex = i
|
||||
if (i - foundIndex + 1 === value.byteLength) return foundIndex
|
||||
} else {
|
||||
if (foundIndex !== -1) i -= i - foundIndex
|
||||
foundIndex = -1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (byteOffset + value.byteLength > buffer.byteLength) {
|
||||
byteOffset = buffer.byteLength - value.byteLength
|
||||
}
|
||||
|
||||
for (let i = byteOffset; i >= 0; i--) {
|
||||
let found = true
|
||||
|
||||
for (let j = 0; j < value.byteLength; j++) {
|
||||
if (buffer[i + j] !== value[j]) {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (found) return i
|
||||
}
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
function indexOf (buffer, value, byteOffset, encoding) {
|
||||
return bidirectionalIndexOf(buffer, value, byteOffset, encoding, true /* first */)
|
||||
}
|
||||
|
||||
function lastIndexOf (buffer, value, byteOffset, encoding) {
|
||||
return bidirectionalIndexOf(buffer, value, byteOffset, encoding, false /* last */)
|
||||
}
|
||||
|
||||
function swap (buffer, n, m) {
|
||||
const i = buffer[n]
|
||||
buffer[n] = buffer[m]
|
||||
buffer[m] = i
|
||||
}
|
||||
|
||||
function swap16 (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits')
|
||||
|
||||
for (let i = 0; i < len; i += 2) swap(buffer, i, i + 1)
|
||||
|
||||
return buffer
|
||||
}
|
||||
|
||||
function swap32 (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits')
|
||||
|
||||
for (let i = 0; i < len; i += 4) {
|
||||
swap(buffer, i, i + 3)
|
||||
swap(buffer, i + 1, i + 2)
|
||||
}
|
||||
|
||||
return buffer
|
||||
}
|
||||
|
||||
function swap64 (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits')
|
||||
|
||||
for (let i = 0; i < len; i += 8) {
|
||||
swap(buffer, i, i + 7)
|
||||
swap(buffer, i + 1, i + 6)
|
||||
swap(buffer, i + 2, i + 5)
|
||||
swap(buffer, i + 3, i + 4)
|
||||
}
|
||||
|
||||
return buffer
|
||||
}
|
||||
|
||||
function toBuffer (buffer) {
|
||||
return buffer
|
||||
}
|
||||
|
||||
function toString (buffer, encoding, start = 0, end = buffer.byteLength) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
if (start >= len) return ''
|
||||
if (end <= start) return ''
|
||||
if (start < 0) start = 0
|
||||
if (end > len) end = len
|
||||
|
||||
if (start !== 0 || end < len) buffer = buffer.subarray(start, end)
|
||||
|
||||
return codecFor(encoding).toString(buffer)
|
||||
}
|
||||
|
||||
function write (buffer, string, offset, length, encoding) {
|
||||
// write(buffer, string)
|
||||
if (offset === undefined) {
|
||||
encoding = 'utf8'
|
||||
|
||||
// write(buffer, string, encoding)
|
||||
} else if (length === undefined && typeof offset === 'string') {
|
||||
encoding = offset
|
||||
offset = undefined
|
||||
|
||||
// write(buffer, string, offset, encoding)
|
||||
} else if (encoding === undefined && typeof length === 'string') {
|
||||
encoding = length
|
||||
length = undefined
|
||||
}
|
||||
|
||||
return codecFor(encoding).write(buffer, string, offset, length)
|
||||
}
|
||||
|
||||
function writeDoubleLE (buffer, value, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
view.setFloat64(offset, value, true)
|
||||
|
||||
return offset + 8
|
||||
}
|
||||
|
||||
function writeFloatLE (buffer, value, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
view.setFloat32(offset, value, true)
|
||||
|
||||
return offset + 4
|
||||
}
|
||||
|
||||
function writeUInt32LE (buffer, value, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
view.setUint32(offset, value, true)
|
||||
|
||||
return offset + 4
|
||||
}
|
||||
|
||||
function writeInt32LE (buffer, value, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
view.setInt32(offset, value, true)
|
||||
|
||||
return offset + 4
|
||||
}
|
||||
|
||||
function readDoubleLE (buffer, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
|
||||
return view.getFloat64(offset, true)
|
||||
}
|
||||
|
||||
function readFloatLE (buffer, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
|
||||
return view.getFloat32(offset, true)
|
||||
}
|
||||
|
||||
function readUInt32LE (buffer, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
|
||||
return view.getUint32(offset, true)
|
||||
}
|
||||
|
||||
function readInt32LE (buffer, offset) {
|
||||
if (offset === undefined) offset = 0
|
||||
|
||||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
|
||||
return view.getInt32(offset, true)
|
||||
}
|
||||
|
||||
module.exports = exports = {
|
||||
isBuffer,
|
||||
isEncoding,
|
||||
alloc,
|
||||
allocUnsafe,
|
||||
allocUnsafeSlow,
|
||||
byteLength,
|
||||
compare,
|
||||
concat,
|
||||
copy,
|
||||
equals,
|
||||
fill,
|
||||
from,
|
||||
includes,
|
||||
indexOf,
|
||||
lastIndexOf,
|
||||
swap16,
|
||||
swap32,
|
||||
swap64,
|
||||
toBuffer,
|
||||
toString,
|
||||
write,
|
||||
writeDoubleLE,
|
||||
writeFloatLE,
|
||||
writeUInt32LE,
|
||||
writeInt32LE,
|
||||
readDoubleLE,
|
||||
readFloatLE,
|
||||
readUInt32LE,
|
||||
readInt32LE
|
||||
}
|
||||
148
Scripts/node_modules/b4a/index.js
generated
vendored
Normal file
148
Scripts/node_modules/b4a/index.js
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
function isBuffer (value) {
|
||||
return Buffer.isBuffer(value) || value instanceof Uint8Array
|
||||
}
|
||||
|
||||
function isEncoding (encoding) {
|
||||
return Buffer.isEncoding(encoding)
|
||||
}
|
||||
|
||||
function alloc (size, fill, encoding) {
|
||||
return Buffer.alloc(size, fill, encoding)
|
||||
}
|
||||
|
||||
function allocUnsafe (size) {
|
||||
return Buffer.allocUnsafe(size)
|
||||
}
|
||||
|
||||
function allocUnsafeSlow (size) {
|
||||
return Buffer.allocUnsafeSlow(size)
|
||||
}
|
||||
|
||||
function byteLength (string, encoding) {
|
||||
return Buffer.byteLength(string, encoding)
|
||||
}
|
||||
|
||||
function compare (a, b) {
|
||||
return Buffer.compare(a, b)
|
||||
}
|
||||
|
||||
function concat (buffers, totalLength) {
|
||||
return Buffer.concat(buffers, totalLength)
|
||||
}
|
||||
|
||||
function copy (source, target, targetStart, start, end) {
|
||||
return toBuffer(source).copy(target, targetStart, start, end)
|
||||
}
|
||||
|
||||
function equals (a, b) {
|
||||
return toBuffer(a).equals(b)
|
||||
}
|
||||
|
||||
function fill (buffer, value, offset, end, encoding) {
|
||||
return toBuffer(buffer).fill(value, offset, end, encoding)
|
||||
}
|
||||
|
||||
function from (value, encodingOrOffset, length) {
|
||||
return Buffer.from(value, encodingOrOffset, length)
|
||||
}
|
||||
|
||||
function includes (buffer, value, byteOffset, encoding) {
|
||||
return toBuffer(buffer).includes(value, byteOffset, encoding)
|
||||
}
|
||||
|
||||
function indexOf (buffer, value, byfeOffset, encoding) {
|
||||
return toBuffer(buffer).indexOf(value, byfeOffset, encoding)
|
||||
}
|
||||
|
||||
function lastIndexOf (buffer, value, byteOffset, encoding) {
|
||||
return toBuffer(buffer).lastIndexOf(value, byteOffset, encoding)
|
||||
}
|
||||
|
||||
function swap16 (buffer) {
|
||||
return toBuffer(buffer).swap16()
|
||||
}
|
||||
|
||||
function swap32 (buffer) {
|
||||
return toBuffer(buffer).swap32()
|
||||
}
|
||||
|
||||
function swap64 (buffer) {
|
||||
return toBuffer(buffer).swap64()
|
||||
}
|
||||
|
||||
function toBuffer (buffer) {
|
||||
if (Buffer.isBuffer(buffer)) return buffer
|
||||
return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
||||
}
|
||||
|
||||
function toString (buffer, encoding, start, end) {
|
||||
return toBuffer(buffer).toString(encoding, start, end)
|
||||
}
|
||||
|
||||
function write (buffer, string, offset, length, encoding) {
|
||||
return toBuffer(buffer).write(string, offset, length, encoding)
|
||||
}
|
||||
|
||||
function writeDoubleLE (buffer, value, offset) {
|
||||
return toBuffer(buffer).writeDoubleLE(value, offset)
|
||||
}
|
||||
|
||||
function writeFloatLE (buffer, value, offset) {
|
||||
return toBuffer(buffer).writeFloatLE(value, offset)
|
||||
}
|
||||
|
||||
function writeUInt32LE (buffer, value, offset) {
|
||||
return toBuffer(buffer).writeUInt32LE(value, offset)
|
||||
}
|
||||
|
||||
function writeInt32LE (buffer, value, offset) {
|
||||
return toBuffer(buffer).writeInt32LE(value, offset)
|
||||
}
|
||||
|
||||
function readDoubleLE (buffer, offset) {
|
||||
return toBuffer(buffer).readDoubleLE(offset)
|
||||
}
|
||||
|
||||
function readFloatLE (buffer, offset) {
|
||||
return toBuffer(buffer).readFloatLE(offset)
|
||||
}
|
||||
|
||||
function readUInt32LE (buffer, offset) {
|
||||
return toBuffer(buffer).readUInt32LE(offset)
|
||||
}
|
||||
|
||||
function readInt32LE (buffer, offset) {
|
||||
return toBuffer(buffer).readInt32LE(offset)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isBuffer,
|
||||
isEncoding,
|
||||
alloc,
|
||||
allocUnsafe,
|
||||
allocUnsafeSlow,
|
||||
byteLength,
|
||||
compare,
|
||||
concat,
|
||||
copy,
|
||||
equals,
|
||||
fill,
|
||||
from,
|
||||
includes,
|
||||
indexOf,
|
||||
lastIndexOf,
|
||||
swap16,
|
||||
swap32,
|
||||
swap64,
|
||||
toBuffer,
|
||||
toString,
|
||||
write,
|
||||
writeDoubleLE,
|
||||
writeFloatLE,
|
||||
writeUInt32LE,
|
||||
writeInt32LE,
|
||||
readDoubleLE,
|
||||
readFloatLE,
|
||||
readUInt32LE,
|
||||
readInt32LE
|
||||
}
|
||||
31
Scripts/node_modules/b4a/lib/ascii.js
generated
vendored
Normal file
31
Scripts/node_modules/b4a/lib/ascii.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
function byteLength (string) {
|
||||
return string.length
|
||||
}
|
||||
|
||||
function toString (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
let result = ''
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
result += String.fromCharCode(buffer[i])
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function write (buffer, string, offset = 0, length = byteLength(string)) {
|
||||
const len = Math.min(length, buffer.byteLength - offset)
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
buffer[offset + i] = string.charCodeAt(i)
|
||||
}
|
||||
|
||||
return len
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
byteLength,
|
||||
toString,
|
||||
write
|
||||
}
|
||||
65
Scripts/node_modules/b4a/lib/base64.js
generated
vendored
Normal file
65
Scripts/node_modules/b4a/lib/base64.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
|
||||
const codes = new Uint8Array(256)
|
||||
|
||||
for (let i = 0; i < alphabet.length; i++) {
|
||||
codes[alphabet.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
codes[/* - */ 0x2d] = 62
|
||||
codes[/* _ */ 0x5f] = 63
|
||||
|
||||
function byteLength (string) {
|
||||
let len = string.length
|
||||
|
||||
if (string.charCodeAt(len - 1) === 0x3d) len--
|
||||
if (len > 1 && string.charCodeAt(len - 1) === 0x3d) len--
|
||||
|
||||
return (len * 3) >>> 2
|
||||
}
|
||||
|
||||
function toString (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
let result = ''
|
||||
|
||||
for (let i = 0; i < len; i += 3) {
|
||||
result += (
|
||||
alphabet[buffer[i] >> 2] +
|
||||
alphabet[((buffer[i] & 3) << 4) | (buffer[i + 1] >> 4)] +
|
||||
alphabet[((buffer[i + 1] & 15) << 2) | (buffer[i + 2] >> 6)] +
|
||||
alphabet[buffer[i + 2] & 63]
|
||||
)
|
||||
}
|
||||
|
||||
if (len % 3 === 2) {
|
||||
result = result.substring(0, result.length - 1) + '='
|
||||
} else if (len % 3 === 1) {
|
||||
result = result.substring(0, result.length - 2) + '=='
|
||||
}
|
||||
|
||||
return result
|
||||
};
|
||||
|
||||
function write (buffer, string, offset = 0, length = byteLength(string)) {
|
||||
const len = Math.min(length, buffer.byteLength - offset)
|
||||
|
||||
for (let i = 0, j = 0; j < len; i += 4) {
|
||||
const a = codes[string.charCodeAt(i)]
|
||||
const b = codes[string.charCodeAt(i + 1)]
|
||||
const c = codes[string.charCodeAt(i + 2)]
|
||||
const d = codes[string.charCodeAt(i + 3)]
|
||||
|
||||
buffer[j++] = (a << 2) | (b >> 4)
|
||||
buffer[j++] = ((b & 15) << 4) | (c >> 2)
|
||||
buffer[j++] = ((c & 3) << 6) | (d & 63)
|
||||
}
|
||||
|
||||
return len
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
byteLength,
|
||||
toString,
|
||||
write
|
||||
}
|
||||
51
Scripts/node_modules/b4a/lib/hex.js
generated
vendored
Normal file
51
Scripts/node_modules/b4a/lib/hex.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
function byteLength (string) {
|
||||
return string.length >>> 1
|
||||
}
|
||||
|
||||
function toString (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
buffer = new DataView(buffer.buffer, buffer.byteOffset, len)
|
||||
|
||||
let result = ''
|
||||
let i = 0
|
||||
|
||||
for (let n = len - (len % 4); i < n; i += 4) {
|
||||
result += buffer.getUint32(i).toString(16).padStart(8, '0')
|
||||
}
|
||||
|
||||
for (; i < len; i++) {
|
||||
result += buffer.getUint8(i).toString(16).padStart(2, '0')
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function write (buffer, string, offset = 0, length = byteLength(string)) {
|
||||
const len = Math.min(length, buffer.byteLength - offset)
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
const a = hexValue(string.charCodeAt(i * 2))
|
||||
const b = hexValue(string.charCodeAt(i * 2 + 1))
|
||||
|
||||
if (a === undefined || b === undefined) {
|
||||
return buffer.subarray(0, i)
|
||||
}
|
||||
|
||||
buffer[offset + i] = (a << 4) | b
|
||||
}
|
||||
|
||||
return len
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
byteLength,
|
||||
toString,
|
||||
write
|
||||
}
|
||||
|
||||
function hexValue (char) {
|
||||
if (char >= 0x30 && char <= 0x39) return char - 0x30
|
||||
if (char >= 0x41 && char <= 0x46) return char - 0x41 + 10
|
||||
if (char >= 0x61 && char <= 0x66) return char - 0x61 + 10
|
||||
}
|
||||
40
Scripts/node_modules/b4a/lib/utf16le.js
generated
vendored
Normal file
40
Scripts/node_modules/b4a/lib/utf16le.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
function byteLength (string) {
|
||||
return string.length * 2
|
||||
}
|
||||
|
||||
function toString (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
let result = ''
|
||||
|
||||
for (let i = 0; i < len - 1; i += 2) {
|
||||
result += String.fromCharCode(buffer[i] + (buffer[i + 1] * 256))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
function write (buffer, string, offset = 0, length = byteLength(string)) {
|
||||
const len = Math.min(length, buffer.byteLength - offset)
|
||||
|
||||
let units = len
|
||||
|
||||
for (let i = 0; i < string.length; ++i) {
|
||||
if ((units -= 2) < 0) break
|
||||
|
||||
const c = string.charCodeAt(i)
|
||||
const hi = c >> 8
|
||||
const lo = c % 256
|
||||
|
||||
buffer[offset + i * 2] = lo
|
||||
buffer[offset + i * 2 + 1] = hi
|
||||
}
|
||||
|
||||
return len
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
byteLength,
|
||||
toString,
|
||||
write
|
||||
}
|
||||
145
Scripts/node_modules/b4a/lib/utf8.js
generated
vendored
Normal file
145
Scripts/node_modules/b4a/lib/utf8.js
generated
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
function byteLength (string) {
|
||||
let length = 0
|
||||
|
||||
for (let i = 0, n = string.length; i < n; i++) {
|
||||
const code = string.charCodeAt(i)
|
||||
|
||||
if (code >= 0xd800 && code <= 0xdbff && i + 1 < n) {
|
||||
const code = string.charCodeAt(i + 1)
|
||||
|
||||
if (code >= 0xdc00 && code <= 0xdfff) {
|
||||
length += 4
|
||||
i++
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (code <= 0x7f) length += 1
|
||||
else if (code <= 0x7ff) length += 2
|
||||
else length += 3
|
||||
}
|
||||
|
||||
return length
|
||||
}
|
||||
|
||||
let toString
|
||||
|
||||
if (typeof TextDecoder !== 'undefined') {
|
||||
const decoder = new TextDecoder()
|
||||
|
||||
toString = function toString (buffer) {
|
||||
return decoder.decode(buffer)
|
||||
}
|
||||
} else {
|
||||
toString = function toString (buffer) {
|
||||
const len = buffer.byteLength
|
||||
|
||||
let output = ''
|
||||
let i = 0
|
||||
|
||||
while (i < len) {
|
||||
let byte = buffer[i]
|
||||
|
||||
if (byte <= 0x7f) {
|
||||
output += String.fromCharCode(byte)
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
let bytesNeeded = 0
|
||||
let codePoint = 0
|
||||
|
||||
if (byte <= 0xdf) {
|
||||
bytesNeeded = 1
|
||||
codePoint = byte & 0x1f
|
||||
} else if (byte <= 0xef) {
|
||||
bytesNeeded = 2
|
||||
codePoint = byte & 0x0f
|
||||
} else if (byte <= 0xf4) {
|
||||
bytesNeeded = 3
|
||||
codePoint = byte & 0x07
|
||||
}
|
||||
|
||||
if (len - i - bytesNeeded > 0) {
|
||||
let k = 0
|
||||
|
||||
while (k < bytesNeeded) {
|
||||
byte = buffer[i + k + 1]
|
||||
codePoint = (codePoint << 6) | (byte & 0x3f)
|
||||
k += 1
|
||||
}
|
||||
} else {
|
||||
codePoint = 0xfffd
|
||||
bytesNeeded = len - i
|
||||
}
|
||||
|
||||
output += String.fromCodePoint(codePoint)
|
||||
i += bytesNeeded + 1
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
|
||||
let write
|
||||
|
||||
if (typeof TextEncoder !== 'undefined') {
|
||||
const encoder = new TextEncoder()
|
||||
|
||||
write = function write (buffer, string, offset = 0, length = byteLength(string)) {
|
||||
const len = Math.min(length, buffer.byteLength - offset)
|
||||
encoder.encodeInto(string, buffer.subarray(offset, offset + len))
|
||||
return len
|
||||
}
|
||||
} else {
|
||||
write = function write (buffer, string, offset = 0, length = byteLength(string)) {
|
||||
const len = Math.min(length, buffer.byteLength - offset)
|
||||
|
||||
buffer = buffer.subarray(offset, offset + len)
|
||||
|
||||
let i = 0
|
||||
let j = 0
|
||||
|
||||
while (i < string.length) {
|
||||
const code = string.codePointAt(i)
|
||||
|
||||
if (code <= 0x7f) {
|
||||
buffer[j++] = code
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
let count = 0
|
||||
let bits = 0
|
||||
|
||||
if (code <= 0x7ff) {
|
||||
count = 6
|
||||
bits = 0xc0
|
||||
} else if (code <= 0xffff) {
|
||||
count = 12
|
||||
bits = 0xe0
|
||||
} else if (code <= 0x1fffff) {
|
||||
count = 18
|
||||
bits = 0xf0
|
||||
}
|
||||
|
||||
buffer[j++] = bits | (code >> count)
|
||||
count -= 6
|
||||
|
||||
while (count >= 0) {
|
||||
buffer[j++] = 0x80 | ((code >> count) & 0x3f)
|
||||
count -= 6
|
||||
}
|
||||
|
||||
i += code >= 0x10000 ? 2 : 1
|
||||
}
|
||||
|
||||
return len
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
byteLength,
|
||||
toString,
|
||||
write
|
||||
}
|
||||
32
Scripts/node_modules/b4a/package.json
generated
vendored
Normal file
32
Scripts/node_modules/b4a/package.json
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "b4a",
|
||||
"version": "1.6.4",
|
||||
"description": "Bridging the gap between buffers and typed arrays",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"browser.js",
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"browser": {
|
||||
"./index.js": "./browser.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && brittle test/*.mjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/holepunchto/b4a.git"
|
||||
},
|
||||
"author": "Kasper Isager Dalsgarð <kasper@funktionel.co>",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/holepunchto/b4a/issues"
|
||||
},
|
||||
"homepage": "https://github.com/holepunchto/b4a#readme",
|
||||
"devDependencies": {
|
||||
"brittle": "^1.3.5",
|
||||
"nanobench": "^2.1.1",
|
||||
"standard": "^16.0.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user