npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

c-compiler

v1.3.0

Published

A simple npm tool to compile C programs via local files or web URLs

Readme

c-compiler

c-compiler is a simple Node.js-based command-line tool designed to compile C programs using the gcc compiler. It allows you to compile .c files from your local system or fetch and compile C code directly from a web URL. This makes it versatile for developers who want to test code stored online or compile local projects quickly.

Installation

To use c-compiler, you need to have Node.js and gcc installed on your system. Follow these steps:

  1. Install Node.js: Download and install Node.js from nodejs.org if you don’t already have it.
  2. Install GCC: Ensure gcc is installed on your system.
    • On Linux: sudo apt install gcc (Ubuntu/Debian) or sudo yum install gcc (CentOS/RHEL).
    • On macOS: Install via Xcode command-line tools (xcode-select --install) or Homebrew (brew install gcc).
    • On Windows: Install MinGW or a similar GCC-compatible compiler and ensure gcc is in your PATH.
  3. Install c-compiler: Run the following command to install the tool globally:
    npm install -g c-compiler

Usage

Use the compile-c command to compile C code from either a local file or a web URL.

Compile from a Local File

compile-c -f <filename>
  • Replace <filename> with the name of your C file (e.g., hello.c).
  • The tool will compile the file into an executable with the same name, minus the .c extension (e.g., hello).

Example

  1. Create a file named hello.c:
    #include <stdio.h>
    int main() {
        printf("Hello, World!\n");
        return 0;
    }
  2. Run the command:
    compile-c -f hello.c
  3. If successful, you’ll see:
    Compiling hello.c...
    Compilation successful!
    Executable created: hello
  4. Run the executable:
    • On Linux/macOS: ./hello
    • On Windows: hello.exe Output: Hello, World!

Compile from a Web URL

compile-c -u <url>
  • Replace <url> with a URL pointing to raw C code (e.g., a GitHub raw file link).
  • The tool will fetch the code, compile it, and create an executable named output.

Example

  1. Use a URL like https://raw.githubusercontent.com/user/repo/main/hello.c containing:
    #include <stdio.h>
    int main() {
        printf("Hello from the web!\n");
        return 0;
    }
  2. Run the command:
    compile-c -u https://raw.githubusercontent.com/user/repo/main/hello.c
  3. If successful, you’ll see:
    Compiling code from URL...
    Compilation successful!
    Executable created: output
  4. Run the executable:
    • On Linux/macOS: ./output
    • On Windows: output.exe Output: Hello from the web!

Error Handling

  • If no file or URL is specified:
    Error: Please specify a C file (-f) or a URL (-u)
  • If both file and URL are specified:
    Error: Please specify either a file (-f) or a URL (-u), not both
  • If the local file doesn’t exist:
    Error: File "nonexistent.c" does not exist
  • If the URL fails to load:
    Error: Failed to fetch C code from URL "<url>"
    <error message>
  • If compilation fails:
    Compilation failed:
    <gcc error output>