mirror of https://github.com/node-red/node-red.git
better handle utf8 file output chars
parent
cda11491c2
commit
b9b5eaccae
|
@ -42,6 +42,7 @@ module.exports = function(RED) {
|
||||||
if (typeof data === "boolean") { data = data.toString(); }
|
if (typeof data === "boolean") { data = data.toString(); }
|
||||||
if (typeof data === "number") { data = data.toString(); }
|
if (typeof data === "number") { data = data.toString(); }
|
||||||
if ((this.appendNewline) && (!Buffer.isBuffer(data))) { data += os.EOL; }
|
if ((this.appendNewline) && (!Buffer.isBuffer(data))) { data += os.EOL; }
|
||||||
|
data = new Buffer(data);
|
||||||
if (this.overwriteFile === "true") {
|
if (this.overwriteFile === "true") {
|
||||||
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while
|
// using "binary" not {encoding:"binary"} to be 0.8 compatible for a while
|
||||||
fs.writeFile(filename, data, "binary", function (err) {
|
fs.writeFile(filename, data, "binary", function (err) {
|
||||||
|
|
Loading…
Reference in New Issue