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
async function initHttpReader(httpReader, sendRequest, getRequestData) { const { url, preventHeadRequest, useRangeHeader, forceRangeRequests, combineSizeEocd } = httpReader; if (isHttpFamily(url) && (useRangeHeader || forceRangeRequests) && (typeof preventHeadRequest == "undefined" || preventHeadRe...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
initHttpReader
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function readUint8ArrayHttpReader(httpReader, index, length, sendRequest, getRequestData) { const { useRangeHeader, forceRangeRequests, eocdCache, size, options } = httpReader; if (useRangeHeader || forceRangeRequests) { if (eocdCache && index == size - END_OF_CENTRAL_DIR_LENGTH && length ...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readUint8ArrayHttpReader
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getRangeHeaders(httpReader, index = 0, length = 1) { return Object.assign({}, getHeaders(httpReader), { [HTTP_HEADER_RANGE]: HTTP_RANGE_UNIT + "=" + (index < 0 ? index : index + "-" + (index + length - 1)) }); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getRangeHeaders
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getHeaders({ options }) { const { headers } = options; if (headers) { if (Symbol.iterator in headers) { return Object.fromEntries(headers); } else { return headers; } } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getHeaders
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function getFetchRequestData(httpReader) { await getRequestData(httpReader, sendFetchRequest); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getFetchRequestData
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function getXMLHttpRequestData(httpReader) { await getRequestData(httpReader, sendXMLHttpRequest); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getXMLHttpRequestData
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function getRequestData(httpReader, sendRequest) { const response = await sendRequest(HTTP_METHOD_GET, httpReader, getHeaders(httpReader)); httpReader.data = new Uint8Array(await response.arrayBuffer()); if (!httpReader.size) { httpReader.size = httpReader.data.length; } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getRequestData
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function getContentLength(httpReader, sendRequest, getRequestData) { if (httpReader.preventHeadRequest) { await getRequestData(httpReader, httpReader.options); } else { const response = await sendRequest(HTTP_METHOD_HEAD, httpReader, getHeaders(httpReader)); const contentLength = response.headers.get...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getContentLength
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function sendFetchRequest(method, { options, url }, headers) { const response = await fetch(url, Object.assign({}, options, { method, headers })); if (response.status < 400) { return response; } else { throw response.status == 416 ? new Error(ERR_HTTP_RANGE) : new Error(ERR_HTTP_STATUS + (response.sta...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
sendFetchRequest
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function sendXMLHttpRequest(method, { url }, headers) { return new Promise((resolve, reject) => { const request = new XMLHttpRequest(); request.addEventListener("load", () => { if (request.status < 400) { const headers = []; request.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(header =>...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
sendXMLHttpRequest
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(url, options = {}) { super(); Object.assign(this, { url, reader: options.useXHR ? new XHRReader(url, options) : new FetchReader(url, options) }); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
set size(value) { // ignored }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
size
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
get size() { return this.reader.size; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
size
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async init() { await this.reader.init(); super.init(); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
init
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
readUint8Array(index, length) { return this.reader.readUint8Array(index, length); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readUint8Array
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(url, options = {}) { options.useRangeHeader = true; super(url, options); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(array) { super(); Object.assign(this, { array, size: array.length }); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
readUint8Array(index, length) { return this.array.slice(index, index + length); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readUint8Array
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
init(initSize = 0) { Object.assign(this, { offset: 0, array: new Uint8Array(initSize) }); super.init(); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
init
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
writeUint8Array(array) { const writer = this; if (writer.offset + array.length > writer.array.length) { const previousArray = writer.array; writer.array = new Uint8Array(previousArray.length + array.length); writer.array.set(previousArray); } writer.array.set(array, writer.offset); writer.off...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
writeUint8Array
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
getData() { return this.array; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getData
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(readers) { super(); this.readers = readers; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async init() { const reader = this; const { readers } = reader; reader.lastDiskNumber = 0; reader.lastDiskOffset = 0; await Promise.all(readers.map(async (diskReader, indexDiskReader) => { await diskReader.init(); if (indexDiskReader != readers.length - 1) { reader.lastDiskOffset += diskRead...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
init
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async readUint8Array(offset, length, diskNumber = 0) { const reader = this; const { readers } = this; let result; let currentDiskNumber = diskNumber; if (currentDiskNumber == -1) { currentDiskNumber = readers.length - 1; } let currentReaderOffset = offset; while (currentReaderOffset >= reade...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readUint8Array
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(writerGenerator, maxSize = 4294967295) { super(); const writer = this; Object.assign(writer, { diskNumber: 0, diskOffset: 0, size: 0, maxSize, availableSize: maxSize }); let diskSourceWriter, diskWritable, diskWriter; const writable = new WritableStream({ async writ...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async write(chunk) { const { availableSize } = writer; if (!diskWriter) { const { value, done } = await writerGenerator.next(); if (done && !value) { throw new Error(ERR_ITERATOR_COMPLETED_TOO_SOON); } else { diskSourceWriter = value; diskSourceWriter.size = 0; if...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
write
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async close() { await diskWriter.ready; await closeDisk(); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
close
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
get() { return writable; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
get
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function writeChunk(chunk) { const chunkLength = chunk.length; if (chunkLength) { await diskWriter.ready; await diskWriter.write(chunk); diskSourceWriter.size += chunkLength; writer.size += chunkLength; writer.availableSize -= chunkLength; } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
writeChunk
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function closeDisk() { diskWritable.size = diskSourceWriter.size; await diskWriter.close(); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
closeDisk
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function isHttpFamily(url) { const { baseURL } = getConfiguration(); const { protocol } = new URL(url, baseURL); return protocol == "http:" || protocol == "https:"; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
isHttpFamily
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function initStream(stream, initSize) { if (stream.init && !stream.initialized) { await stream.init(initSize); } else { return Promise.resolve(); } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
initStream
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function initReader(reader) { if (Array.isArray(reader)) { reader = new SplitDataReader(reader); } if (reader instanceof ReadableStream) { reader = { readable: reader }; } return reader; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
initReader
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function initWriter(writer) { if (writer.writable === UNDEFINED_VALUE && typeof writer.next == FUNCTION_TYPE) { writer = new SplitDataWriter(writer); } if (writer instanceof WritableStream) { writer = { writable: writer }; } const { writable } = writer; if (writable.size === UNDEFINED_VALUE) { ...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
initWriter
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readUint8Array(reader, offset, size, diskNumber) { return reader.readUint8Array(offset, size, diskNumber); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readUint8Array
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function decodeCP437(stringValue) { if (VALID_CP437) { let result = ""; for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) { result += CP437[stringValue[indexCharacter]]; } return result; } else { return new TextDecoder().decode(stringValue); } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
decodeCP437
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function decodeText(value, encoding) { if (encoding && encoding.trim().toLowerCase() == "cp437") { return decodeCP437(value); } else { return new TextDecoder(encoding).decode(value); } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
decodeText
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(data) { PROPERTY_NAMES.forEach(name => this[name] = data[name]); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(reader, options = {}) { Object.assign(this, { reader: initReader(reader), options, config: getConfiguration() }); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async* getEntriesGenerator(options = {}) { const zipReader = this; let { reader } = zipReader; const { config } = zipReader; await initStream(reader); if (reader.size === UNDEFINED_VALUE || !reader.readUint8Array) { reader = new BlobReader(await new Response(reader.readable).blob()); await initSt...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getEntriesGenerator
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async getEntries(options = {}) { const entries = []; for await (const entry of this.getEntriesGenerator(options)) { entries.push(entry); } return entries; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getEntries
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(options = {}) { const { readable, writable } = new TransformStream(); const gen = new ZipReader(readable, options).getEntriesGenerator(); this.readable = new ReadableStream({ async pull(controller) { const { done, value } = await gen.next(); if (done) return controller.close(); ...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async pull(controller) { const { done, value } = await gen.next(); if (done) return controller.close(); const chunk = { ...value, readable: (function () { const { readable, writable } = new TransformStream(); if (value.getData) { value.getData(writable); re...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
pull
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(reader, config, options) { Object.assign(this, { reader, config, options }); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async getData(writer, fileEntry, options = {}) { const zipEntry = this; const { reader, offset, diskNumberStart, extraFieldAES, compressionMethod, config, bitFlag, signature, rawLastModDate, uncompressedSize, compressedSize } = zipEntry; const localDirectory = fil...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getData
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readCommonHeader(directory, dataView, offset) { const rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset + 2); const encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED; const rawLastModDate = getUint32(dataView, offset + 6); Object.assign(directory, { encrypted, version...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readCommonHeader
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory) { const { rawExtraField } = directory; const extraField = directory.extraField = new Map(); const rawExtraFieldView = getDataView$1(new Uint8Array(rawExtraField)); let offsetExtraField = 0; try { while (offsetExtraField < raw...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readCommonFooter
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readExtraFieldZip64(extraFieldZip64, directory) { directory.zip64 = true; const extraFieldView = getDataView$1(extraFieldZip64.data); const missingProperties = ZIP64_PROPERTIES.filter(([propertyName, max]) => directory[propertyName] == max); for (let indexMissingProperty = 0, offset = 0; indexMissingPr...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readExtraFieldZip64
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) { const extraFieldView = getDataView$1(extraFieldUnicode.data); const crc32 = new Crc32(); crc32.append(fileEntry[rawPropertyName]); const dataViewSignature = getDataView$1(new Uint8Array(4)); dataViewSignat...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readExtraFieldUnicode
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readExtraFieldAES(extraFieldAES, directory, compressionMethod) { const extraFieldView = getDataView$1(extraFieldAES.data); const strength = getUint8(extraFieldView, 4); Object.assign(extraFieldAES, { vendorVersion: getUint8(extraFieldView, 0), vendorId: getUint8(extraFieldView, 2), strength, ...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readExtraFieldAES
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readExtraFieldNTFS(extraFieldNTFS, directory) { const extraFieldView = getDataView$1(extraFieldNTFS.data); let offsetExtraField = 4; let tag1Data; try { while (offsetExtraField < extraFieldNTFS.data.length && !tag1Data) { const tagValue = getUint16(extraFieldView, offsetExtraField); const at...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readExtraFieldNTFS
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory) { const extraFieldView = getDataView$1(extraFieldExtendedTimestamp.data); const flags = getUint8(extraFieldView, 0); const timeProperties = []; const timeRawProperties = []; if (localDirectory) { if ((flags & 0...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
readExtraFieldExtendedTimestamp
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function seekSignature(reader, signature, startOffset, minimumBytes, maximumLength) { const signatureArray = new Uint8Array(4); const signatureView = getDataView$1(signatureArray); setUint32$1(signatureView, 0, signature); const maximumBytes = minimumBytes + maximumLength; return (await seek(minimumByte...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
seekSignature
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function seek(length) { const offset = startOffset - length; const bytes = await readUint8Array(reader, offset, length); for (let indexByte = bytes.length - minimumBytes; indexByte >= 0; indexByte--) { if (bytes[indexByte] == signatureArray[0] && bytes[indexByte + 1] == signatureArray[1] && byte...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
seek
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getOptionValue$1(zipReader, options, name) { return options[name] === UNDEFINED_VALUE ? zipReader.options[name] : options[name]; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getOptionValue$1
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getDate(timeRaw) { const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & 0x0000ffff; try { return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0); // eslint-disable-next-line no-unused-vars ...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getDate
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getDateNTFS(timeRaw) { return new Date((Number((timeRaw / BigInt(10000)) - BigInt(11644473600000)))); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getDateNTFS
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getUint8(view, offset) { return view.getUint8(offset); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getUint8
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getUint16(view, offset) { return view.getUint16(offset, true); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getUint16
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getUint32(view, offset) { return view.getUint32(offset, true); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getUint32
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getBigUint64(view, offset) { return Number(view.getBigUint64(offset, true)); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getBigUint64
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function setUint32$1(view, offset, value) { view.setUint32(offset, value, true); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
setUint32$1
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getDataView$1(array) { return new DataView(array.buffer); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getDataView$1
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(writer, options = {}) { writer = initWriter(writer); const addSplitZipSignature = writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !== Infinity && writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !== Infinity; Object.assi...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async add(name = "", reader, options = {}) { const zipWriter = this; const { pendingAddFileCalls, config } = zipWriter; if (workers < config.maxWorkers) { workers++; } else { await new Promise(resolve => pendingEntries.push(resolve)); } let promiseAddFile; try { name = name.t...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
add
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async close(comment = new Uint8Array(), options = {}) { const zipWriter = this; const { pendingAddFileCalls, writer } = this; const { writable } = writer; while (pendingAddFileCalls.size) { await Promise.allSettled(Array.from(pendingAddFileCalls)); } await closeFile(this, comment, options); con...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
close
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
constructor(options = {}) { const { readable, writable } = new TransformStream(); this.readable = readable; this.zipWriter = new ZipWriter(writable, options); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
constructor
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
transform(path) { const { readable, writable } = new TransformStream({ flush: () => { this.zipWriter.close(); } }); this.zipWriter.add(path, readable); return { readable: this.readable, writable }; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
transform
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
writable(path) { const { readable, writable } = new TransformStream(); this.zipWriter.add(path, readable); return writable; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
writable
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
close(comment = undefined, options = {}) { return this.zipWriter.close(comment, options); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
close
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function addFile(zipWriter, name, reader, options) { name = name.trim(); const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE); const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? 20 : 768); const executable = getO...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
addFile
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function getFileEntry(zipWriter, name, reader, entryInfo, options) { const { files, writer } = zipWriter; const { keepOrder, dataDescriptor, signal } = options; const { headerInfo } = entryInfo; const { usdz } = zipWriter.options; const previousFileEntry = Array.from(files.values...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getFileEntry
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function requestLockCurrentFileEntry() { fileEntry.lock = new Promise(resolve => releaseLockCurrentFileEntry = resolve); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
requestLockCurrentFileEntry
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function requestLockWriter() { zipWriter.writerLocked = true; const { lockWriter } = zipWriter; zipWriter.lockWriter = new Promise(resolve => releaseLockWriter = () => { zipWriter.writerLocked = false; resolve(); }); await lockWriter; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
requestLockWriter
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function skipDiskIfNeeded(writable) { if (getLength(headerInfo.localHeaderArray) > writer.availableSize) { writer.availableSize = 0; await writeData(writable, new Uint8Array()); } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
skipDiskIfNeeded
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryInfo, config, options) { const { headerInfo, dataDescriptorInfo, metadataSize } = entryInfo; const { localHeaderArray, headerArray, lastModDate, rawLastModDate, encrypted, compressed, version, compressi...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
createFileEntry
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getHeaderInfo(options) { const { rawFilename, lastModDate, lastAccessDate, creationDate, level, zip64, zipCrypto, useUnicodeFileNames, dataDescriptor, directory, rawExtraField, encryptionStrength, extendedTimestamp, encrypted } = options; let { version, compressi...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getHeaderInfo
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function appendExtraFieldUSDZ(entryInfo, zipWriterOffset) { const { headerInfo } = entryInfo; let { localHeaderArray, extraFieldLength } = headerInfo; let localHeaderArrayView = getDataView(localHeaderArray); let extraBytesLength = 64 - ((zipWriterOffset + getLength(localHeaderArray)) % 64); if (extraBytesLen...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
appendExtraFieldUSDZ
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getDataDescriptorInfo(options) { const { zip64, dataDescriptor, dataDescriptorSignature } = options; let dataDescriptorArray = new Uint8Array(); let dataDescriptorView, dataDescriptorOffset = 0; if (dataDescriptor) { dataDescriptorArray = new Uint8Array(zip64 ? (dataDescriptorSignature ? ...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getDataDescriptorInfo
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function setEntryInfo(entryInfo, options) { const { signature, rawExtraFieldZip64, compressedSize, uncompressedSize, headerInfo, dataDescriptorInfo } = entryInfo; const { headerView, encrypted } = headerInfo; const { dataDescriptorView, dataDescriptorOffset } = dataDescriptorIn...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
setEntryInfo
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function writeExtraHeaderInfo(fileEntry, entryData, writable, { zipCrypto }) { let arrayBuffer; arrayBuffer = await entryData.slice(0, 26).arrayBuffer(); if (arrayBuffer.byteLength != 26) { arrayBuffer = arrayBuffer.slice(0, 26); } const arrayBufferView = new DataView(arrayBuffer); if (!fileEntry.e...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
writeExtraHeaderInfo
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function setZip64ExtraInfo(fileEntry, options) { const { rawExtraFieldZip64, offset, diskNumberStart } = fileEntry; const { zip64UncompressedSize, zip64CompressedSize, zip64Offset, zip64DiskNumberStart } = options; const rawExtraFieldZip64View = getDataView(rawExtraFieldZip64); let rawExtraFieldZip64Offset = 4;...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
setZip64ExtraInfo
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function closeFile(zipWriter, comment, options) { const { files, writer } = zipWriter; const { diskOffset, writable } = writer; let { diskNumber } = writer; let offset = 0; let directoryDataLength = 0; let directoryOffset = zipWriter.offset - diskOffset; let filesLength = files.size; for (const [,...
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
closeFile
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
async function writeData(writable, array) { const streamWriter = writable.getWriter(); try { await streamWriter.ready; writable.size += getLength(array); await streamWriter.write(array); } finally { streamWriter.releaseLock(); } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
writeData
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getTimeNTFS(date) { if (date) { return ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000)); } }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getTimeNTFS
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getOptionValue(zipWriter, options, name, defaultValue) { const result = options[name] === UNDEFINED_VALUE ? zipWriter.options[name] : options[name]; return result === UNDEFINED_VALUE ? defaultValue : result; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getOptionValue
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getMaximumCompressedSize(uncompressedSize) { return uncompressedSize + (5 * (Math.floor(uncompressedSize / 16383) + 1)); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getMaximumCompressedSize
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function setUint8(view, offset, value) { view.setUint8(offset, value); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
setUint8
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function setUint16(view, offset, value) { view.setUint16(offset, value, true); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
setUint16
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function setUint32(view, offset, value) { view.setUint32(offset, value, true); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
setUint32
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function setBigUint64(view, offset, value) { view.setBigUint64(offset, value, true); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
setBigUint64
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function arraySet(array, typedArray, offset) { array.set(typedArray, offset); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
arraySet
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getDataView(array) { return new DataView(array.buffer); }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getDataView
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
function getLength(...arrayLikes) { let result = 0; arrayLikes.forEach(arrayLike => arrayLike && (result += arrayLike.length)); return result; }
HMAC with the specified hash function. @constructor @param {bitArray} key the key for HMAC. @param {Object} [Hash=hash.sha1] The hash function to use.
getLength
javascript
gildas-lormeau/zip.js
dist/zip.js
https://github.com/gildas-lormeau/zip.js/blob/master/dist/zip.js
BSD-3-Clause
concat(a1, a2) { if (a1.length === 0 || a2.length === 0) { return a1.concat(a2); } const last = a1[a1.length - 1], shift = bitArray.getPartial(last); if (shift === 32) { return a1.concat(a2); } else { return bitArray._shiftRight(a2, shift, last | 0, a1.slice(0, a1.length - 1)); } }
Concatenate two bit arrays. @param {bitArray} a1 The first array. @param {bitArray} a2 The second array. @return {bitArray} The concatenation of a1 and a2.
concat
javascript
gildas-lormeau/zip.js
lib/core/streams/codecs/sjcl.js
https://github.com/gildas-lormeau/zip.js/blob/master/lib/core/streams/codecs/sjcl.js
BSD-3-Clause
bitLength(a) { const l = a.length; if (l === 0) { return 0; } const x = a[l - 1]; return (l - 1) * 32 + bitArray.getPartial(x); }
Find the length of an array of bits. @param {bitArray} a The array. @return {Number} The length of a, in bits.
bitLength
javascript
gildas-lormeau/zip.js
lib/core/streams/codecs/sjcl.js
https://github.com/gildas-lormeau/zip.js/blob/master/lib/core/streams/codecs/sjcl.js
BSD-3-Clause
clamp(a, len) { if (a.length * 32 < len) { return a; } a = a.slice(0, Math.ceil(len / 32)); const l = a.length; len = len & 31; if (l > 0 && len) { a[l - 1] = bitArray.partial(len, a[l - 1] & 0x80000000 >> (len - 1), 1); } return a; }
Truncate an array. @param {bitArray} a The array. @param {Number} len The length to truncate to, in bits. @return {bitArray} A new array, truncated to len bits.
clamp
javascript
gildas-lormeau/zip.js
lib/core/streams/codecs/sjcl.js
https://github.com/gildas-lormeau/zip.js/blob/master/lib/core/streams/codecs/sjcl.js
BSD-3-Clause
partial(len, x, _end) { if (len === 32) { return x; } return (_end ? x | 0 : x << (32 - len)) + len * 0x10000000000; }
Make a partial word for a bit array. @param {Number} len The number of bits in the word. @param {Number} x The bits. @param {Number} [_end=0] Pass 1 if x has already been shifted to the high side. @return {Number} The partial word.
partial
javascript
gildas-lormeau/zip.js
lib/core/streams/codecs/sjcl.js
https://github.com/gildas-lormeau/zip.js/blob/master/lib/core/streams/codecs/sjcl.js
BSD-3-Clause
getPartial(x) { return Math.round(x / 0x10000000000) || 32; }
Get the number of bits used by a partial word. @param {Number} x The partial word. @return {Number} The number of bits used by the partial word.
getPartial
javascript
gildas-lormeau/zip.js
lib/core/streams/codecs/sjcl.js
https://github.com/gildas-lormeau/zip.js/blob/master/lib/core/streams/codecs/sjcl.js
BSD-3-Clause
_shiftRight(a, shift, carry, out) { if (out === undefined) { out = []; } for (; shift >= 32; shift -= 32) { out.push(carry); carry = 0; } if (shift === 0) { return out.concat(a); } for (let i = 0; i < a.length; i++) { out.push(carry | a[i] >>> shift); carry = a[i] << (32 - shift); } ...
Shift an array right. @param {bitArray} a The array to shift. @param {Number} shift The number of bits to shift. @param {Number} [carry=0] A byte to carry in @param {bitArray} [out=[]] An array to prepend to the output. @private
_shiftRight
javascript
gildas-lormeau/zip.js
lib/core/streams/codecs/sjcl.js
https://github.com/gildas-lormeau/zip.js/blob/master/lib/core/streams/codecs/sjcl.js
BSD-3-Clause