1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
290 views
by nathan-b-7857 (330 points)
Looking to see if there's a function like the below:
qie.getFileName();

In which I can retrieve the size of an associated file.

The source connector is an FTP retriever.

2 Answers

0 votes
You can use the length property of message.getBytes() to get the size of the current message in bytes.  For example, the below would store the file size in a variable called fileSize:

var fileSize = message.getBytes().length;
by jon-t-7005 (8.2k points)
0 votes

If you are looking for the size of a file that is on the disk you can use the following:

var file = new java.io.File("/filePath");

if (file.exists() && file.isFile()) {
   var fileSizeInBytes = file.length();
   qie.debug('fileSizeInBytes: ' + fileSizeInBytes);
}

by brandon-w-8204 (34.1k points)
...