1/* this callback will run once the main context sends a message */ 2self.addEventListener('message', (e) => { 3 importScripts("https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js"); 4 var reader = new FileReader(); 5 reader.onload = evt => { 6 const bstr = evt.target.result; 7 const wb = XLSX.read(bstr, {type: "binary"}); 8 if(wb.SheetNames.length > 1) { 9 const files = []; 10 wb.SheetNames.forEach(sheetName => { 11 const response = XLSX.utils.sheet_to_csv(wb.Sheets[sheetName], { 12 FS: ',', 13 RS: '\n', 14 strip: true, 15 blankrows: false, 16 }); 17 files.push(response); 18 }); 19 20 /* Pass the result data back */ 21 postMessage({ files, sheetNames: wb.SheetNames }); 22 } else { 23 const response = XLSX.utils.sheet_to_csv(wb.Sheets[wb.SheetNames[0]], { 24 FS: ',', 25 RS: '\n', 26 strip: true, 27 blankrows: false, 28 }); 29 /* Pass the result data back */ 30 postMessage({ file: response }); 31 } 32 } 33 reader.readAsArrayBuffer(e.data); 34}, false);
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.