Chris
08/04/2020, 2:44 PM// download the file from FTP server
var fileObj = objConnection.download({
filename: filename //"Name_######_csv" // filename
});
fileObj.folder = runtime.getCurrentScript().getParameter({name: 'XXXXXXX_files_directory'});
fileObj.name = filename + '.csv';
fileObj.save();
var convertedData = Base64.decode(fileObj.getContents());
log.debug("convertedData", JSON.stringify(convertedData));
Above is how the current script is written and works just fine.
Below was my quick update for testing a file. When I check the debug logs convertedData and other objects are gibberish. (ex:M?Óü\u001eÊ&{õ\u000).
Is File.load not the correct way to set the fileObj?
var fileObj = file.load({
id: 12345
});
var convertedData = Base64.decode(fileObj.getContents());
log.debug("convertedData", JSON.stringify(convertedData));
battk
08/04/2020, 3:01 PMbattk
08/04/2020, 3:02 PMbattk
08/04/2020, 3:02 PMbattk
08/04/2020, 3:03 PMbattk
08/04/2020, 3:05 PMChris
08/04/2020, 3:33 PMChris
08/04/2020, 3:34 PMChris
08/04/2020, 3:56 PM