Hi,
I want to compress multiple files into one zip file:
When reading the instructions of zip
node, it seems to be able to do this with the input payload is Array, I tried it without understanding how input filename and payload are correct !?
[{"id":"db2e6476.273128","type":"file in","z":"aa5a77d3.21b528","name":"","filename":"","format":"","chunk":false,"sendError":false,"encoding":"none","x":1210,"y":2400,"wires":[["29eaaf6.381265"]]},{"id":"9cb5f8ae.f87fb8","type":"function","z":"aa5a77d3.21b528","name":"","func":"var arrFiles = [];\n\narrFiles.push('C:\\\\Temp\\\\Test\\\\File1.txt');\narrFiles.push('C:\\\\Temp\\\\Test\\\\File2.txt');\narrFiles.push('C:\\\\Temp\\\\Test\\\\File3.txt');\n\n//msg.filename = arrFiles.toString();\nmsg.arrFiles = arrFiles;\n\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":2300,"wires":[["30b15e87.412962"]]},{"id":"2ced30c0.015fa","type":"inject","z":"aa5a77d3.21b528","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":690,"y":2300,"wires":[["9cb5f8ae.f87fb8"]]},{"id":"d2f256d9.3a7c78","type":"split","z":"aa5a77d3.21b528","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":870,"y":2400,"wires":[["22656107.c3054e"]]},{"id":"22656107.c3054e","type":"change","z":"aa5a77d3.21b528","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":2400,"wires":[["db2e6476.273128"]]},{"id":"30b15e87.412962","type":"change","z":"aa5a77d3.21b528","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"arrFiles","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":2400,"wires":[["d2f256d9.3a7c78"]]},{"id":"e464d114.b7505","type":"zip","z":"aa5a77d3.21b528","name":"","mode":"compress","filename":"","outasstring":false,"x":830,"y":2500,"wires":[["2d2f0be2.c417b4"]]},{"id":"2d2f0be2.c417b4","type":"change","z":"aa5a77d3.21b528","name":"","rules":[{"t":"set","p":"filenameNew","pt":"msg","to":"$replace(filename,/^.*[\\\\\\/]/, '')\t","tot":"jsonata"},{"t":"change","p":"filename","pt":"msg","from":"filenameNew","fromt":"msg","to":"ZIP_NEW.zip","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1183.234375,"y":2495.25,"wires":[["de7cf02e.901ff"]]},{"id":"de7cf02e.901ff","type":"change","z":"aa5a77d3.21b528","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"\"C:\\\\Temp\\\\Test\\\\\" & msg.filename","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":2500,"wires":[["69ffe535.eecedc"]]},{"id":"69ffe535.eecedc","type":"file","z":"aa5a77d3.21b528","name":"","filename":"","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":1130,"y":2600,"wires":[["8192bbdf.6cf858"]]},{"id":"29eaaf6.381265","type":"change","z":"aa5a77d3.21b528","name":"","rules":[{"t":"change","p":"filename","pt":"msg","from":"C:\\Temp\\Test\\","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1380,"y":2400,"wires":[["e464d114.b7505"]]},{"id":"8192bbdf.6cf858","type":"debug","z":"aa5a77d3.21b528","name":"msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1430,"y":2600,"wires":[]},{"id":"23f55ef0.5ed142","type":"join","z":"aa5a77d3.21b528","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":670,"y":2500,"wires":[["e464d114.b7505"]]},{"id":"26b89ffb.7ba54","type":"join","z":"aa5a77d3.21b528","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":993.234375,"y":2535.25,"wires":[["2d2f0be2.c417b4"]]},{"id":"c11dbe74.ba0d8","type":"join","z":"aa5a77d3.21b528","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1270,"y":2640,"wires":[[]]}]
Please tell me.
Thanks!