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 🙏

© 2024 – Pkg Stats / Ryan Hefner

wolfram-beta

v1.3.9

Published

A terminal client with image support for Wolfram | Alpha Pro, built on top of the Wolfree framework.

Downloads

17

Readme

Wolfram | Beta

A Node.js package that uses Puppeteer to grab step-by-step solutions from Wolfram|Alpha® queries directly in your terminal (with HTML support) without needing an API key. Wolfram|Beta provides a command-line interface to input queries, fetch and parse data from Wolfram|Alpha®, and is fully hackable for future adaptation!

Jump to Usage.

photo1

Intent

This project aims to merely serve as an educational demonstration of extending the capabilities of an existing service to the terminal environment.

Table of Contents

Installation

From Command Line (Recommended for Linux / Mac)

Simply run one of the following commands in your terminal:

curl -o- https://codeberg.org/woflydev/WolframBeta/raw/branch/main/install.sh | bash
wget -qO- https://codeberg.org/woflydev/WolframBeta/raw/branch/main/install.sh | bash

This downloads a script (which you can view the source code of here) that uses NVM (Node Version Manager) to install the latest LTS version of Node if needed, and subsequently installs Wolfram|Beta globally to the command line.

For Windows installations, it is recommended to install Node with NVM for Windows, as the above script will not work. It is worth noting, however, that NVM for Mac / Linux is a completely different project.

From Source

Make sure you have yarn or npm. Project was built in Node v18 but should be back compatible.

Clone the repository:

git clone https://codeberg.org/woflydev/WolframBeta.git
cd WolframBeta
yarn

From NPM (Recommended for Windows)

Ensure you have Node installed, either via Standalone or NVM. Simply add globally via the package manager of your choice:

npm i wolfram-beta -g
yarn global add wolfram-beta

Usage

Run the script with the desired options to query Wolfram|Alpha and display the results in the terminal.

yarn start [options]

or

wolfram-beta [options]

Alternatively, you can quickly launch specific flags (repo clone only).

yarn ask [options] # launches with -i
yarn dev [options] # launches with -d
yarn help [options] # launches with -h and exits
yarn test [options] # launches with -t and uses default input
yarn version # launches with -v

Available options:

  • -u, --update: Update Wolfram|Beta to the latest version. Overrides all other options and exits.
  • -v, --version: Show the current version of Wolfram|Beta. Overrides all other options except -u and --update, then exits.
  • -d, --dev: Show technical information JSON for debugging.
  • -s, --source: Show source information of the query.
  • -o, --open: Open the generated HTML file in the default browser.
  • -t, --test: Run the program in test mode, and use the default input.
  • -i, --input <question>: Directly use the input provided from the command line. Will be overriden by -t and --test.
  • -w, --wait <timeout>: Wait a specified amount of time after forming a connection before grabbing information, useful for slow internet connections.
  • -h, --help: Display available options on launch, then exit.

Example

> node wolfram-beta
$ What do you want to calculate or know about?
> population of spain
$
$ processing...
$ Query Result Information:
$
$ Input interpretation
$ Spain | population
$
$ Result
$ 47.5 million people (world rank: 32nd) (2023 estimate)
$ Image(s) Found!
$ https://www6b3.wolframalpha.com/Calculate/MSP/MSP13381208dc8g4d56degb0000627c66d4a46301hf?MSPStoreType=image/gif&s=4
$
$ ...(there's more)

The best part? It formats it all nicely with colours and headings, to make it easier to read. It also outputs all of the parsed content (including images) to an HTML file in the same directory, which would be better for viewing multiple plots in one go. The HTML file is always generated but you can pass in the -o flag to open it automatically on completion.

How It Works

The package leverages Puppeteer to launch a headless browser instance, essentially 'piggybacking' off of the wonderful work of contributors over at Wolfree|Alpha to provide step-by-step solutions. The resulting JSON is scraped with CSS selectors and contains answer results which are parsed and sorted.

Contributing

Contributions are more than welcome! The codebase is a mess though (since I wrote it) so be warned. If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.

  1. Fork the repository.
  2. Create a new branch for your feature: git checkout -b feature-name
  3. Make your changes and commit them: git commit -m 'some feature or fix'
  4. Push the changes to your fork: git push origin feature-name
  5. Submit a pull request.

License

Do whatever you want with it under GPL-v3.

photo2