Nim Standard Library Documentation
Navigation
Overview
Author: Andreas Rumpf
Version: 2.2.6
Nim's library ecosystem is organized into three categories: pure libraries (no external binary dependencies), impure libraries (requiring external binaries), and wrappers (low-level C library interfaces).
For additional packages, visit Nimble Directory.
Pure Libraries
Automatic Imports
- system — Basic procs and operators that every program needs, with IO functionality. Imported implicitly; do not import directly.
Core
Algorithms
- algorithm — Generic algorithms (sort, binary search)
- enumutils — Enhanced enum functionality
- sequtils — Functional programming operations for sequences
- setutils — Enhanced set functionality
Collections
- critbits — Crit bit tree for sorted strings/mappings
- deques — Double-ended queue implementation
- heapqueue — Binary heap/priority queue
- intsets — Sparse bit set for integers
- lists — Singly/doubly linked and circular lists
- options — Optional value encapsulation
- packedsets — Sparse bit set for ordinals
- ropes — Efficient long string representation
- sets — Hash set support
- strtabs — String-to-string hash table with case modes
- tables — Hash, ordered, and count tables
String Handling
Time Handling
- monotimes — Monotonic timestamp implementation
- times — Time working and manipulation
Generic Operating System Services
- appdirs — Special directory determination
- cmdline — Command line parameter reading
- dirs — Directory operations
- distros — OS distribution detection and package manager basics
- dynlib — Shared library symbol access
- envvars — Environment variable operations
- exitprocs — Program exit hooks
- files — File operations
- memfiles — Memory-mapped file support
- os — Basic operating system facilities for environment, arguments, directories, and shell commands
- oserrors — OS error reporting
- osproc — Advanced process communication
- paths — Path operations
- reservedmem — Address space reservation without physical memory
- streams — Stream interface with File and String implementations
- symlinks — Symbolic link operations
- syncio — Synchronized I/O operations
- terminal — Terminal/console output control
- tempfiles — Temporary file/directory creation
Math Libraries
- complex — Complex numbers and operations
- fenv — Floating-point environment and exception handling
- lenientops — Mixed integer/float operators
- math — Mathematical functions (cosine, square root, etc.)
- random — Fast lightweight RNG
- rationals — Rational numbers and operations
- stats — Statistical analysis
- sysrand — Cryptographically secure PRNG
Internet Protocols and Support
Threading
Parsers
- htmlparser — HTML document parser to XML tree
- json — High-performance JSON parser
- lexbase — Efficient buffering for lexers/parsers
- parsecfg — Configuration file parser (INI-like)
- parsecsv — CSV parser
- parsejson — JSON parser
- parseopt — Command line option parser
- parsesql — SQL parser
- parseutils — Token, number, and identifier parsing helpers
- parsexml — XML/HTML parser (UTF-8, error-correcting)
- pegs — PEG procedures and operators
Docutils
XML Processing
- xmltree — Simple XML tree with code generation macro
- xmlparser — XML document parser to tree representation
Generators
- genasts — AST generation via captured variables
- htmlgen — HTML/XML code generator with tag macros
Hashing
- base64 — Base64 encoding/decoding
- hashes — Efficient hash value computation
- md5 — MD5 checksum algorithm
- oids — Globally unique ID via timestamp, counter, random value
- sha1 — SHA-1 checksum algorithm
Serialization
- jsonutils — Hookable JSON (de)serialization
- marshal — Nim data structure serialization/deserialization
Miscellaneous
JavaScript Backend Modules
- asyncjs — Async types and macros for JavaScript
- dom — Document Object Model declarations
- jsbigints — Arbitrary precision integers
- jsconsole — console object wrapper
- jscore — Core JavaScript functions wrapper
- jsfetch — fetch wrapper
- jsffi — JavaScript interoperability types and macros
- jsre — JavaScript regular expressions
Impure Libraries
Regular Expressions
- re — Procedures and operators for handling regular expressions using PCRE
- nre — Helper functions for regular expressions using PCRE
Database Support
- db_mysql — MySQL wrapper with standard cross-database interface
- db_odbc — ODBC wrapper with standard cross-database interface
- db_postgres — PostgreSQL wrapper with standard cross-database interface
- db_sqlite — SQLite wrapper with standard cross-database interface
Generic Operating System Services
- rdstdin — User input reading from stdin
Wrappers
(Note: Some wrapper HTML documentation is too large for distribution; view on the website.)
Windows-Specific
- winlean — Small Win32 API subset wrapper
- registry — Windows registry support
UNIX-Specific
Regular Expressions
- pcre — PCRE library wrapper
Database Support
Network Programming and Internet Protocols
Source: nim-lang.org/docs/lib.html — Generated: 2025-10-31