I wish to extract the file path and then the filename with extension, essentially leaving me with the file name and file from an event object in AWS Lambda using Node.js
Here is an example file path
/home/mysite/public_html/services/wp-content/uploads/woocommerce_uploads/wcj_uploads/input_fields_uploads/myfilename.docx
var docfilename = event.line_items[0].meta_data[0].value.tmp_name;
var docextension = event.line_items[0].meta_data[0].value.tmp_name;
console.log(event.line_items[0].meta_data[0].value.tmp_name);
The desired output would just be "myfilename" in the first instance and "myfilename.docx" in the second instance