Change file node to use node 4 syntax (drops support for 0.8)

This commit is contained in:
Dave Conway-Jones 2016-12-22 13:17:08 +00:00
parent b6b65b6bf7
commit 4cbe264869
1 changed files with 4 additions and 4 deletions

View File

@ -45,8 +45,8 @@ module.exports = function(RED) {
data = new Buffer(data);
if (this.overwriteFile === "true") {
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while
fs.writeFile(filename, data, "binary", function (err) {
//fs.writeFile(filename, data, {encoding:"binary"}, function (err) {
//fs.writeFile(filename, data, "binary", function (err) {
fs.writeFile(filename, data, {encoding:"binary"}, function (err) {
if (err) {
if ((err.code === "ENOENT") && node.createDir) {
fs.ensureFile(filename, function (err) {
@ -71,8 +71,8 @@ module.exports = function(RED) {
}
else {
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while longer
fs.appendFile(filename, data, "binary", function (err) {
//fs.appendFile(filename, data, {encoding:"binary"}, function (err) {
//fs.appendFile(filename, data, "binary", function (err) {
fs.appendFile(filename, data, {encoding:"binary"}, function (err) {
if (err) {
if ((err.code === "ENOENT") && node.createDir) {
fs.ensureFile(filename, function (err) {