The following code will return a filename based on the timestamp and the original filename and will change the file extension to jpeg. This is needed while converting and compressing files.
function (file) {
let newName = new Date().getTime() + '_' + file.name.substr(0, file.name.lastIndexOf('.'))+'.jpeg';
return newName;
}