on 03-09-2020 7:29 AM
Hi,
I want to write the xsjs response in a .dat file. I am able to write the response in .dat file and its being downloaded.
This is the below code.
$.response.setBody(strF);
$.response.contentType = 'application/vnd.ms-excel; charset=utf-16le';
$.response.headers.set('Content-Disposition','attachment;filename=POC3.dat');
$.response.status= $.net.http.OK;
But I want to restrict the download part and write this file "POC3.dat" in UNIX file system.
All these needs to be done through XSJS only. I am using XS advanced.
Any lead would be appreiated.
Well if its a remove file system and its in an NFS mount, it shouldn't matter. The API will write to it as though its local and won't know the difference. If you are truly talking about a remote file system with no connection to your server then you would have to look at other technology like FTP to send the file to the remote server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi thomas,
Below is my code to write file in UNIX file path.
var fs = $.require('fs');
fs.writeFile('/INPUT/Home/folder1/folder2/helloWorld.txt', 'Hello World!', function (err) {
if (err) {
return console.log(err);}
console.log('Hello World > helloWorld.txt');
});
. we are using anonymous connection in XSA
Already UNIX path is mounted with HANA XSA DB
But still getting below error :
{ Error: EACCES: permission denied, open '/INPUT/Home/folder1/folder2/helloWorld.txt'
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/INPUT/Home/folder1/folder2/helloWorld.txt' }
thanks,
subrahmanya
User | Count |
---|---|
81 | |
11 | |
10 | |
8 | |
8 | |
6 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.