Comparing version 1.0.5 to 1.0.6
@@ -0,1 +1,11 @@ | ||
<a name="1.0.6"></a> | ||
## [1.0.6](https://github.com/mongodb/js-bson/compare/v1.0.5...v1.0.6) (2018-03-12) | ||
### Features | ||
* **serialization:** support arbitrary sizes for the internal serialization buffer ([abe97bc](https://github.com/mongodb/js-bson/commit/abe97bc)) | ||
<a name="1.0.5"></a> | ||
@@ -2,0 +12,0 @@ ## 1.0.5 (2018-02-26) |
@@ -27,5 +27,6 @@ 'use strict'; | ||
*/ | ||
// Max Size | ||
// Default Max Size | ||
var MAXSIZE = 1024 * 1024 * 17; | ||
// Max Document Buffer size | ||
// Current Internal Temporary Serialization Buffer | ||
var buffer = new Buffer(MAXSIZE); | ||
@@ -42,2 +43,3 @@ | ||
* @param {Boolean} [options.ignoreUndefined=true] ignore undefined fields **(default:true)**. | ||
* @param {Number} [options.minInternalBufferSize=1024*1024*17] minimum size of the internal temporary serialization buffer **(default:1024*1024*17)**. | ||
* @return {Buffer} returns the Buffer object containing the serialized object. | ||
@@ -54,2 +56,9 @@ * @api public | ||
typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true; | ||
var minInternalBufferSize = | ||
typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE; | ||
// Resize the internal serialization buffer if needed | ||
if (buffer.length < minInternalBufferSize) { | ||
buffer = new Buffer(minInternalBufferSize); | ||
} | ||
@@ -99,3 +108,3 @@ // Attempt to serialize | ||
var serializationIndex = serializer( | ||
buffer, | ||
finalBuffer, | ||
object, | ||
@@ -108,3 +117,2 @@ checkKeys, | ||
); | ||
buffer.copy(finalBuffer, startIndex, 0, serializationIndex); | ||
@@ -111,0 +119,0 @@ // Return the index |
@@ -6,3 +6,3 @@ { | ||
"files": ["lib", "index.js", "browser_build", "bower.json"], | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"author": "Christian Amor Kvalheim <christkv@gmail.com>", | ||
@@ -9,0 +9,0 @@ "contributors": [], |
@@ -71,3 +71,5 @@ # BSON parser | ||
For all BSON types documentation, please refer to the documentation for the [MongoDB Node.js driver](https://github.com/mongodb/node-mongodb-native). | ||
For all BSON types documentation, please refer to the following sources: | ||
* [MongoDB BSON Type Reference](https://docs.mongodb.com/manual/reference/bson-types/) | ||
* [BSON Spec](https://bsonspec.org/) | ||
@@ -74,0 +76,0 @@ ### BSON serialization and deserialiation |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153
732581
20438