javascript - Node base64 encode doesn't give whole string -
good day,
i having weird issue node, encoding file base64 , albeit works of pdfs encoding, 1 in particular doesn't output whole base64 string.
the actual b64 string starts this: "jvberi0xljmkjf////8kniawig9i..."
"jvberi0xljmk"
here code:
function sendpdf() { // grab final pdf require('fs').readfile(transaction.deliverable, function (err, data) { if (err) { console.log(err); log(2, "couldn't read: " + transaction.deliverable); } else { transaction.deliverable = new buffer(data, 'binary').tostring('base64'); //transaction.deliverable = data.tostring('base64'); console.log(transaction.deliverable); }
the commented out line attempt. transaction structure is:
function transaction(snapshot) { var data = snapshot.val(); this.tid = snapshot.key(); this.request = data.request; this.pages = []; this.filecount = 0; this.deliverable = null; this.filename = ""; }
this transaction simple stores information pull firebase important var, .deliverable
string path of pdf need encode , send.
i don't read errors when happens, , next transaction goes through code block fine, giving full base64 string.
i curious if tostring()
interpolating base64 string, thought have had larger problems earlier.
any ideas? can put on hold , move on work love fix this.. thank you.
Comments
Post a Comment