code-excerpt extracts specific lines or regions from source code files. It's useful for generating code snippets in documentation, tutorials, or error messages. Its primary function is to accept a filename and line number range, then return the corresponding code block, handling various edge cases like file not found or invalid range. Supports basic syntax highlighting. Provides clean and easily integrates into other tools for programmatically handling source code.
The npm package code-excerpt has infrequent releases. Initially, there were a few releases in 2016 and 2017. Version 2.1.1 was released in January 2018, followed by version 3.0.0 in June 2020, and version 4.0.0 in February 2022. There have been no releases since February 2022, indicating a period of inactivity.
code-excerpt downloads show consistent growth from March 2024 to August 2025, peaking at over 8.6 million. The initial data for September 2025 indicates a significant drop, likely due to the month being incomplete. Overall, the package demonstrates strong and increasing usage.