diff --git a/README.md b/README.md index ac92e2de..5d8cd371 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 22b825c6..87a50592 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/Client.js b/src/Client.js index 2ddbfc1b..f51b1b6a 100644 --- a/src/Client.js +++ b/src/Client.js @@ -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) => {