From 1287e99ab9e093c541754b670af9553b6b773c6e Mon Sep 17 00:00:00 2001 From: "stefan.poeter@cloud-automation.de" Date: Thu, 1 Dec 2016 18:17:22 +0100 Subject: [PATCH] - Changed new Buffer() to Buffer.alloc(1024, 0) in the Readme and in the server core. new Buffer() is deprecated. --- README.md | 6 +++--- src/modbus-server-core.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d979cad..3580da8 100644 --- a/README.md +++ b/README.md @@ -151,9 +151,9 @@ Server example 'responseDelay' : 10, // so we do not fry anything when someone is polling this server // specify coils, holding and input register here as buffer or leave it for them to be new Buffer(1024) - coils : new Buffer(1024), - holding : new Buffer(1024), - input : new Buffer(1024) + coils : Buffer.alloc(1024, 0), + holding : Buffer.alloc(1024, 0), + input : Buffer.alloc(1024, 0) }) .compose(modbus.server.tcp.complete) .init(function () { diff --git a/src/modbus-server-core.js b/src/modbus-server-core.js index 2e9c173..305eef2 100644 --- a/src/modbus-server-core.js +++ b/src/modbus-server-core.js @@ -14,19 +14,19 @@ var core = stampit() var init = function () { if (!this.coils) { - coils = new Buffer(1024) + coils = Buffer.alloc(1024, 0) } else { coils = this.coils } if (!this.holding) { - holding = new Buffer(1024) + holding = Buffer.alloc(1024, 0) } else { holding = this.holding } if (!this.input) { - input = new Buffer(1024) + input = Buffer.alloc(1024, 0) } else { input = this.input }