Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Compatible with Node 12.3.0 and higher versions. #378

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

The Pulsar Node.js client can be used to create Pulsar producers and consumers in Node.js. For the supported Pulsar features, see [Client Feature Matrix](https://pulsar.apache.org/client-feature-matrix/).

This library works only in Node.js 10.x or later because it uses the
[node-addon-api](https://github.com/nodejs/node-addon-api) module to wrap the C++ library.
This library works only in Node.js 12.3 or later because it uses:
1. The [node-addon-api](https://github.com/nodejs/node-addon-api) module to wrap the C++ library.
2. The [Mozilla CA](https://nodejs.org/api/tls.html#tlsrootcertificates) file, which is provided by Node.js v12.3.0 and subsequent versions.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"license": "Apache-2.0",
"gypfile": true,
"engines": {
"node": ">=10.16.0"
"node": ">=12.3.0"
},
"devDependencies": {
"@seadub/clang-format-lint": "0.0.2",
Expand Down
9 changes: 8 additions & 1 deletion src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ class Client {
}

static genCertFile() {
fs.rmSync(certsFilePath, { force: true });
try {
if (fs.existsSync(certsFilePath)) {
fs.unlinkSync(certsFilePath);
}
} catch (err) {
console.error(err);
}

const fd = fs.openSync(certsFilePath, 'a');
try {
tls.rootCertificates.forEach((cert) => {
Expand Down
Loading