mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	| @@ -49,9 +49,12 @@ module.exports = function(RED) { | ||||
|             else if (msg.hasOwnProperty("payload") && (typeof msg.payload !== "undefined")) { | ||||
|                 var dir = path.dirname(filename); | ||||
|                 if (node.createDir) { | ||||
|                     fs.ensureDir(dir, function(err) { | ||||
|                         if (err) { node.error(RED._("file.errors.createfail",{error:err.toString()}),msg); } | ||||
|                     }); | ||||
|                     try { | ||||
|                         fs.ensureDirSync(dir); | ||||
|                     } catch(err) { | ||||
|                         node.error(RED._("file.errors.createfail",{error:err.toString()}),msg); | ||||
|                         return; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 var data = msg.payload; | ||||
| @@ -60,11 +63,11 @@ 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; } | ||||
|                 if ((node.appendNewline) && (!Buffer.isBuffer(data))) { data += os.EOL; } | ||||
|                 node.data.push(Buffer.from(data)); | ||||
|  | ||||
|                 while (node.data.length > 0) { | ||||
|                     if (this.overwriteFile === "true") { | ||||
|                     if (node.overwriteFile === "true") { | ||||
|                         node.wstream = fs.createWriteStream(filename, { encoding:'binary', flags:'w', autoClose:true }); | ||||
|                         node.wstream.on("error", function(err) { | ||||
|                             node.error(RED._("file.errors.writefail",{error:err.toString()}),msg); | ||||
|   | ||||
| @@ -45,7 +45,7 @@ | ||||
|         "express": "4.16.2", | ||||
|         "express-session": "1.15.6", | ||||
|         "follow-redirects": "1.3.0", | ||||
|         "fs-extra": "1.0.0", | ||||
|         "fs-extra": "5.0.0", | ||||
|         "fs.notify": "0.0.4", | ||||
|         "hash-sum": "1.0.2", | ||||
|         "i18next": "1.10.6", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user