There is only one way writing files to DataPower filesystem not going through XML Management set-file request:
<dp:dump-nodes> allows to store a nodeSet under a specified filename in "temporary:" folder.
nodeSet has one limitation, and that is that you cannot store arbitrary (binary) files that way.
Adding this functionality (write binary files) to dump-nodes was what RFE 71699 was about.
Customer did know that storing base64 encoded binary data is possible, but wanted to be able to write binary data.
OK, an RFE (Request For Enhancement) requests to add new functionality to a next major release. RFE 71699 was rejected because writing binary data to temporary: folder is possible with today's firmware. Yes, you need the latest 7.2.0.x firmware (for "dp:gatewayscript()" and GatewayScript "_.readsAsXML()"), but 7.2.0 is definitely earlier available than a next major release. The RFE developer update describes in short how to do with v7.2.0 firmware, this blog posting will give you the details.
OK, first we have to write (binary) data to a file in "temporary:" folder with GatewayScript. This can be done via the "fs" (filesystem) API in writing eg. a Buffer. The tricky part is how a XSLT can pass a binaryNode to GatewayScript. A binaryNode is handled in DataPower as "special" XML. And therefore you have to read the input via readAsXML(), the nodelist returned will contain just a single element for a binaryNode passed from XSLT, and that can be easily ".toBuffer()"ed. So this is the complete GatewayScript fs.write.js (click for download):
Now we need only to pass a binary node in XSLT in dp:gatewayscript() call, stylesheet fs.write.xsl (click for download) shows that there is no magic at all, just pass the binaryNode as "input" in dp:gatewayscript() [you have to store "fs.write.js" above into "local:" folder]
Here you can see coproc2 call that executes XSLT and passed Non-XML data (0x03 is no valid XML character):
$ coproc2 fs.write.xsl <(echo -en 'te\x3t') http://dp6-l3:2224
$
And here we see in DataPower CLI what is going on:
xi50(config)# dir temporary:
File Name Last Modified Size
--------- ------------- ----
log/ Jan 27, 2016 1:24:05 PM 4096
datapowerjs/ Jan 11, 2016 11:56:03 AM 4096
export/ Jan 11, 2016 11:56:03 AM 4096
dpmon/ Jan 28, 2016 5:16:00 AM 4096
ftp-response/ Jan 11, 2016 11:56:03 AM 4096
image/ Jan 7, 2016 8:37:04 AM 4096
221792.9 MB available to temporary:
xi50(config)# show file temporary:test.dat
% Unable to display 'temporary:test.dat' - file is not printable
xi50(config)# dir temporary:
File Name Last Modified Size
--------- ------------- ----
log/ Jan 27, 2016 1:24:05 PM 4096
datapowerjs/ Jan 11, 2016 11:56:03 AM 4096
test.dat Jan 28, 2016 5:25:01 AM 4
export/ Jan 11, 2016 11:56:03 AM 4096
dpmon/ Jan 28, 2016 5:16:00 AM 4096
ftp-response/ Jan 11, 2016 11:56:03 AM 4096
image/ Jan 7, 2016 8:37:04 AM 4096
221792.9 MB available to temporary:
xi50(config)#
Hermann.