Create a new BAM parser with specified options and interrupt support
BAM parser configuration options including AbortSignal
Parse BAM records from a file using Bun's optimized file I/O
Path to BAM file to parse
Optional
options: FileReaderOptionsFile reading options for performance tuning
Parse BAM records from a binary stream with optimized BGZF handling
ReadableStream of binary BAM data
Parse BAM records from a binary string (base64 or hex encoded)
String containing binary BAM data (base64 or hex encoded)
Get parsing statistics for performance monitoring
Statistics object with performance metrics
Static
createCreate a performance-optimized BAM parser instance
Optional
options: { bufferSize?: number; skipValidation?: boolean; enableWarnings?: boolean }Performance tuning options
Optimized parser instance
Load BAI index file for indexed access to BAM data
Path to BAI index file
Optional
options: BAIReaderOptionsBAI reader options
Promise resolving when index is loaded
Query genomic region using loaded BAI index
Reference sequence name (e.g., 'chr1', '1')
Start coordinate (1-based, inclusive)
End coordinate (1-based, inclusive)
AsyncIterable of alignments in the specified region
Set reference sequence names for mapping reference IDs
Array of reference sequence names in order
Get statistics about loaded BAI index
Promise resolving to index statistics
Close BAI index and clean up resources
Streaming BAM parser with BGZF decompression and binary decoding
Designed for memory efficiency with large BAM files from modern sequencers. Handles real-world BAM complexity including:
Example: Basic usage
Example: With custom options