1importScripts("/wp-content/uploads/2022/03/heic-convert-lib.js"); 2 3async function goConvert(file, fileNameNoExtension, rowId, from, to, options) { 4 sendStatusUpdate(rowId, "Converting file...", "PROCESSING"); 5 6 try { 7 var outputFileNameWithExtension = fileNameNoExtension + "." + to; 8 9 var fileReader = new FileReader(); 10 fileReader.onload = async function() { 11 var result = fileReader.result; 12 13 var format = 'JPEG'; 14 if (to === 'png') format = 'PNG'; 15 16 const outputBuffer = await heicconvert({ 17 buffer: result, 18 format: format, 19 quality: 1 20 }); 21 22 var contentType = extensionToContentType[to]; 23 var outputBlob = new Blob([outputBuffer], {type: contentType}); 24 25 sendCompletedFile(rowId, outputBlob, outputFileNameWithExtension, to); 26 }; 27 fileReader.readAsArrayBuffer(file); 28 29 } catch (err) { 30 console.log(err); 31 sendStatusUpdate(rowId, "Conversion error.", "ERROR"); 32 } 33}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.