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

compiler-api

v1.2.3

Published

An api to compile your code which supports multiple programming languages using G4G's api.

Readme

compiler-api

An api to compile your code which supports multiple programming languages using G4G's api.

Installation

Install using npm:

npm install compiler-api

Usage

Require library

const compiler = require('compiler-api');
//specify programming language, code and input if any else put empty string
var data = {
  language: 'language',
  code: 'code',
  input: 'stdin input'
}

const result = await compiler.compilerApi(data);

Pass the 'data' object as a parameter to this function. Define keys lang, code and input. If your code don't have any input then put an empty string. Refer below available programming languages for lang keywords.

Available programming languages with keyword-

  • Java - java
  • Python - python
  • Python3 - python3
  • C - c
  • C++ - cpp
  • C++14 - cpp14
  • C# - Csharp
  • Perl - perl
  • PHP - php
  • Scala - scala

Example Code Snippet

var data = {
  language: 'python3',
  code: 'print(\"Hello\")',
  input: ''
}

const result = await compiler.compilerApi(data);

Response

{
  id: 'f178db80-702c-4e54-9343-904ba700b52d',
  submission_id: 'f178db80-702c-4e54-9343-904ba700b52d',
  language: 'python3',
  status: 'SUCCESS',
  compResult: 'S',
  time: '0.014',
  memory: '7.05859375',
  output: 'hi\n',
  rntError: '',
  errorCode: '',
  save: 'false',
  code: 'print("hi")',
  input: '',
  timestamp: '2022-11-06 16:45:41'
}

Response when there is compile time error in code

{
  id: 'bea36a74-f6d6-43f6-910c-576472693e1d',
  submission_id: 'bea36a74-f6d6-43f6-910c-576472693e1d',
  status: 'success'
}
{
  status: 'SUCCESS',
  id: 'bea36a74-f6d6-43f6-910c-576472693e1d',
  submission_id: 'bea36a74-f6d6-43f6-910c-576472693e1d',
  language: 'java',
  compResult: 'F', //compile result is F (Fail)
  errorCode: 'CE',
  cmpError: './GFG.java:1: error: class, interface, or enum expected\n' +
    'print("hi")\n' +
    '^\n' +
    '1 error\n',
  save: 'false',
  code: 'print("hi")',
  input: '',
  timestamp: '2022-11-06 16:49:14'
}

Response when there is run time error in code

{
  id: '27bab3e6-d092-4339-b1b3-2429f07b1ce1',
  submission_id: '27bab3e6-d092-4339-b1b3-2429f07b1ce1',
  language: 'python3',
  status: 'SUCCESS',
  compResult: 'S',
  time: '0.017',
  memory: '7.32421875',
  output: '',
  rntError: 'Traceback (most recent call last):\n' + //run time error details
    '  File "27bab3e6-d092-4339-b1b3-2429f07b1ce1.py", line 1, in <module>\n' +
    '    prints("hi")\n' +
    "NameError: name 'prints' is not defined\n" +
    ' ',
  errorCode: 'RTE',
  save: 'false',
  code: 'prints("hi")',
  input: '',
  timestamp: '2022-11-06 16:47:30'
}

Response when lang param is not valid

{ message: 'Invalid language' }

About Me

Het Delwadiya