How to write file in Data power local folder directory using java script?

284 views Asked by At

anyone have any idea that how to write file in Data power local folder directory? I know we can write in temporary folder directory. It seems there is permission issue while writing the file in Data Power local folder director. I want to write in java script language. By using fs module, I can only create file in temp directory.

I tried creating a file in temporary directory using fs module. I couldn't be able to create a directory or access local directory in Data Power device.

2

There are 2 answers

0
Anders On BEST ANSWER

Well, you can actually, but it is a rather hacky solution. You need to set up the SOMA endpoint and then you can use url-open to post the file to SOMA as a new config.

The performance is not good doing it that way, but I have written GWS to do it...

0
bjimba On

Short answer: you can't.

Slightly longer answer: By design, the local:/// filesystem on DataPower devices is read-only, meant to contain deployed code and config files. This is explicitly stated in the docs for the GatewayScript fs module:

You can read files from the local:, store:, and temporary: directories. You can write files in the temporary: directory.