Skip to content

Conversation

lutovich
Copy link
Contributor

Previously code always used constructor to create NodeJS buffers. Constructor is overloaded to create buffer from an array, another buffer, string or with specified size. It is deprecated in newer NodeJS versions in favor of static factories like Buffer.alloc() and Buffer.from(). First allocates a buffer of the specified size. Second creates buffer based on the given string, array or another buffer.

This PR makes code use static factories instead of the constructor, when available. This makes construction of buffers work in older NodeJS environments that only have the constructor and new environments, that potentially only have static factories.

Related to #336

Previously code always used constructor to create NodeJS buffers.
Constructor is overloaded to create buffer from an array,
another buffer, string or with specified size. It is deprecated in
newer NodeJS versions in favor of static factories like `Buffer.alloc()`
and `Buffer.from()`. First allocates a buffer of the specified size.
Second creates buffer based on the given string, array or another buffer.

This commit makes code use static factories instead of the constructor,
when available. This makes construction of buffers work in older NodeJS
environments that only have the constructor and new environments, that
potentially only have static factories.
@lutovich lutovich requested a review from zhenlineo April 11, 2018 14:44
@zhenlineo zhenlineo merged commit 3041f6c into neo4j:1.6 Apr 12, 2018
@lutovich lutovich deleted the 1.6-nodejs-buffer-ctor branch April 12, 2018 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants