1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

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) {