I have the following code block in Java which I am trying to replicate in nodejs
Java
----
Blob attachmentFile = (Blob) attachments.get(i).get("attachmentFile");
test.setFILECONTENT(attachmentFile.getBytes(1, (int)attachmentFile.length()));
That file is stored as a blob in the database. This Java code works. I am now trying to replicate this in nodejs. So first I did
node.js
----
let content = fs.readFileSync('filepath', {encoding: 'utf-8'});
So here, instead of the file being a blob, I have the file sitting in an FTP folder. I can read the contents of the file by using the line above but how do I convert them into bytes like I did in Java? I am looking to get the exact same output like I got in Java because that stuff works but the node stuff doesn't.