diff --git a/nodes/core/storage/50-file.js b/nodes/core/storage/50-file.js index 4f4c82d74..bb90927e7 100644 --- a/nodes/core/storage/50-file.js +++ b/nodes/core/storage/50-file.js @@ -42,6 +42,7 @@ module.exports = function(RED) { if (typeof data === "boolean") { data = data.toString(); } if (typeof data === "number") { data = data.toString(); } if ((this.appendNewline) && (!Buffer.isBuffer(data))) { data += os.EOL; } + 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) {