node_modules/bson/dist/bson.esm.js
/**
 * Deserialize stream data as BSON documents.
 *
 * @param data - the buffer containing the serialized set of BSON documents.
 * @param startIndex - the start index in the data Buffer where the deserialization is to start.
 * @param numberOfDocuments - number of documents to deserialize.
 * @param documents - an array where to store the deserialized documents.
 * @param docStartIndex - the index in the documents array from where to start inserting documents.
 * @param options - additional options used for the deserialization.
 * @returns next index in the buffer after deserialization **x** numbers of documents.
 * @public
 */
Deserialize stream data as BSON documents.
@param data - the buffer containing the serialized set of BSON documents.
@param startIndex - the start index in the data Buffer where the deserialization is to start.
@param numberOfDocuments - number of documents to deserialize.
@param documents - an array where to store the deserialized documents.
@param docStartIndex - the index in the documents array from where to start inserting documents.
@param options - additional options used for the deserialization.
@returns next index in the buffer after deserialization **x** numbers of documents.
@public
Deserialize stream data as BSON documents . @param data - the buffer containing the serialized set of BSON documents . @param startIndex - the start index in the data Buffer where the deserialization is to start . @param numberOfDocuments - number of documents to deserialize . @param documents - an array where to store the deserialized documents . @param docStartIndex - the index in the documents array from where to start inserting documents . @param options - additional options used for the deserialization . @returns next index in the buffer after deserialization ** x ** numbers of documents . @public
function deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
    var internalOptions = Object.assign({ allowObjectSmallerThanBufferSize: true, index: 0 }, options);
    var bufferData = ensureBuffer(data);
    var index = startIndex;
    for (var i = 0; i < numberOfDocuments; i++) {
        var size = bufferData[index] |
            (bufferData[index + 1] << 8) |
            (bufferData[index + 2] << 16) |
            (bufferData[index + 3] << 24);
        internalOptions.index = index;
        documents[docStartIndex + i] = deserialize$1(bufferData, internalOptions);
        index = index + size;
    }
    return index;
}
function deserializeStream ( data , startIndex , numberOfDocuments , documents , docStartIndex , options ) { var internalOptions = Object . assign ( { allowObjectSmallerThanBufferSize : true , index : 0 } , options ) ; var bufferData = ensureBuffer ( data ) ; var index = startIndex ; for ( var i = 0 ; i < numberOfDocuments ; i ++ ) { var size = bufferData [ index ] | ( bufferData [ index + 1 ] << 8 ) | ( bufferData [ index + 2 ] << 16 ) | ( bufferData [ index + 3 ] << 24 ) ; internalOptions . index = index ; documents [ docStartIndex + i ] = deserialize$1 ( bufferData , internalOptions ) ; index = index + size ; } return index ; }
Deserialize stream data as BSON documents.
Deserialize stream data as BSON documents .
// Loop over all documents // Find size of the document // Update options with index // Parse the document at this point // Adjust index by the document size // Return object containing end index of parsing and list of documents