← Files Biological Sequence & Alignment ViewerARCHIVED FILE

src/compressed-file-name.ts

571 Bytes · Sep 30, 2026 · 23:01 UTC

↓ Download file

const gzipCompressionSuffix = /\.(?:bgz|bgzf|bgzip|gz)$/iu;

export function isGzipCompressedBiologicalFileName(fileName: string): boolean {
  return gzipCompressionSuffix.test(fileName);
}

export function stripBiologicalCompressionSuffix(fileName: string): string {
  return fileName.replace(gzipCompressionSuffix, "");
}

export function biologicalFileBasename(filePath: string): string {
  const lastSeparator = Math.max(
    filePath.lastIndexOf("/"),
    filePath.lastIndexOf("\\"),
  );
  return lastSeparator < 0 ? filePath : filePath.slice(lastSeparator + 1);
}

SHA-256: 14f75c7c529fca8cf9199ed97fbe469b5405bcafe10f3dadb525be9d4c28f353