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

node-hackerearth

v1.2.0

Published

A node.js wrapper for the HackerEarth API.

Downloads

34

Readme

node-hackerearth

npm status Travis build status

A node.js wrapper for the HackerEarth API.

Currently, both version 2 and 3 of the HackerEarth API are supported through node-hackerearth. However, version 2 has been discontinued by HackerEarth.

Further information on the HackerEarth API and its features are available at https://www.hackerearth.com/docs/api/developers/code/v3/.

Table of Contents

Installation

Installing using npm (node package manager):

npm install node-hackerearth

If you don't have npm installed or don't want to use it:

cd ~/.node_libraries
git clone [email protected]:imjching/node-hackerearth.git

Please note that parts of node-hackerearth depend on request by Mikeal Rogers. This library needs to be installed for the API to work. If you are using npm, all dependencies should be automatically resolved for you.

Usage

Attention: Support for v2 of the HackerEarth API is not yet well tested as the API endpoints have been discontinued by HackerEarth.

HackerEarthAPI takes two arguments. The first argument is your client secret key, which you can register one here. The second argument is an options object which can contain the following options:

  • version The API version to use (2 or 3). Defaults to 3.

The HackerEarth API provides two main functions: compile and run. These are available in this wrapper. You can use the methods compile and run and each of them takes two parameters:

  • params Parameters to pass to the API method
  • callback Callback function for returned data or errors with two parameters. The first one being an error object which is null when no error occured, the second one an object with all information retrieved as long as no error occured.

Example:

var HackerEarthAPI = require('node-hackerearth');

var clientSecretKey = 'Your client secret key';

var api = new HackerEarthAPI(clientSecretKey);

var data = "print 'Hello World'";

api.compile({ source: data, lang: 'PYTHON' }, function (err, data) {
  if (err) {
    console.log(err.message);
  } else {
    console.log(JSON.stringify(data)); // Do something with your data
  }
});

api.run({ source: data, lang: 'PYTHON', time_limit: 1 }, function (err, data) {
  if (err) {
    console.log(err.message);
  } else {
    console.log(JSON.stringify(data)); // Do something with your data
  }
});

TODO

  • Complete unit tests

License

node-hackerearth is licensed under the MIT License. (See LICENSE)