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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jq-wasm

v1.1.0-jq-1.8.1

Published

A high-performance jq wrapper using Emscripten and WebAssembly.

Downloads

3,379

Readme

jq-wasm

jq-wasm is a WebAssembly-powered version of the powerful jq JSON processor, built using Emscripten. It brings the versatility of jq to Node.js and modern browsers without any native dependencies.

🚀 Features

  • Cross-Platform: Run jq seamlessly in Node.js and browsers.
  • No Native Dependencies: Everything runs in WebAssembly.
  • Fully Typed: Comes with TypeScript definitions for a great developer experience.
  • Familiar jq Syntax: Use standard jq queries and command-line flags.

📦 Installation

Install via npm:

npm install jq-wasm

or with Yarn:

yarn add jq-wasm

🛠️ Usage

const jq = require("jq-wasm");
// or, with ES modules:
// import * as jq from "jq-wasm";

(async () => {
  try {
    // Example JSON input
    const json = { foo: "bar", list: [1, 2, 3] };

    // Using jq.raw for raw output.
    // It returns an object with stdout, stderr, and exitCode.
    const rawResult = await jq.raw(json, ".list | .[]", ["-c"]);
    console.log("STDOUT:", rawResult.stdout);
    console.log("STDERR:", rawResult.stderr);
    console.log("Exit Code:", rawResult.exitCode);

    // Using jq.json for parsed output.
    // It automatically throws if there is any stderr output.
    const result = await jq.json(json, ".foo");
    console.log("Parsed Output:", result);
  } catch (err) {
    console.error("Error:", err.message);
  }
})();

📖 API

jq.raw(json, query, [flags])

Executes a jq query and returns the raw output along with error and exit code information.

Parameters

  • json: A JSON object, array, or string. Non-string values are automatically stringified.
  • query: A jq query string (e.g., .foo, .[]).
  • flags (optional): An array of jq command-line flags (e.g., ["-c"] for compact output).

Returns

A Promise that resolves to an object with:

  • stdout: The raw output string from jq.
  • stderr: Any error messages generated by jq.
  • exitCode: The exit code returned by jq.

jq.json(json, query, [flags])

Executes a jq query and returns the parsed JSON result.

Parameters

  • json: A JSON object, array, or string. Non-string values are automatically stringified.
  • query: A jq query string.
  • flags (optional): An array of jq flags (e.g., ["-c"] for compact output).

Returns

A Promise that resolves to:

  • A single parsed JSON object or array if jq produces one result.
  • An array of parsed JSON objects or arrays if jq produces multiple newline-separated results.
  • null if no output is produced.

Note: If jq produces any stderr output, jq.json will throw an error.

jq.version()

Returns the underlying jq version string.

Returns

A Promise that resolves to the jq version string (e.g., "jq-1.7.1").

📚 License

This project is licensed under the MIT License.

🌟 Contributions

Contributions, issues, and feature requests are welcome! Feel free to check out the issues page.