UNPKG

itk-wasm

Version:

High-performance spatial analysis in a web browser, Node.js, and reproducible execution across programming languages and hardware architectures.

23 lines 950 B
function getFileExtension(filePath) { let extension = filePath.slice((filePath.lastIndexOf('.') - 1 >>> 0) + 2); if (extension.toLowerCase() === 'gz') { const index = filePath.slice(0, -3).lastIndexOf('.'); extension = filePath.slice((index - 1 >>> 0) + 2); } else if (extension.toLowerCase() === 'cbor') { const index = filePath.slice(0, -5).lastIndexOf('.'); extension = filePath.slice((index - 1 >>> 0) + 2); } else if (extension.toLowerCase() === 'zst') { // .iwi.cbor.zstd const index = filePath.slice(0, -10).lastIndexOf('.'); extension = filePath.slice((index - 1 >>> 0) + 2); } else if (extension.toLowerCase() === 'zip') { const index = filePath.slice(0, -4).lastIndexOf('.'); extension = filePath.slice((index - 1 >>> 0) + 2); } return extension; } export default getFileExtension; //# sourceMappingURL=get-file-extension.js.map