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

play-nes

v2.0.0

Published

Desktop NES emulator in Node.js

Readme

play-nes is a desktop NES emulator written in TypeScript and running on Node.js. It uses JSNES for emulation and sfml.js for native windows, graphics and audio. Local ROM files and keyboard input for two players are supported.

Screenshots

| Contra | Concentration Room | NESert Golfing | Interglactic Transmissing! | | :---: | :---: | :---: | :---: | | | | | |

Captured from the player on macOS.

Installation

Install from npm and launch a bundled game:

$ npm install -g play-nes
$ nes contra

Node.js 22 is recommended. Installation also requires Python and a C++20 compiler because sfml.js builds a native addon.

| Platform | Toolchain | | :--- | :--- | | macOS 13+, Intel or Apple Silicon | Xcode Command Line Tools | | Linux x64 | GCC or Clang, make, X11, OpenGL and audio development libraries | | Windows x64 / ia32 | Visual Studio 2022 C++ Build Tools |

The sfml.js installation guide has the platform-specific commands. The supported Node.js range is ^18.19.0 || >=20.5.0.

A graphical desktop and an audio output device are required to run the player.

Usage

Pass a ROM path to nes:

$ nes "/path/to/your game.nes"

The following aliases load the four bundled ROMs:

$ nes contra        # Contra
$ nes croom         # Concentration Room
$ nes dgolf         # NESert Golfing
$ nes transmissing  # Interglactic Transmissing!

Controls

| NES button | Player 1 | Player 2 | | :--- | :---: | :---: | | A | J | Numpad 5 | | B | K | Numpad 6 | | Select | Right Shift | Numpad 8 | | Start | Enter | Numpad 9 | | Up | W | ↑ | | Down | S | ↓ | | Left | A | ← | | Right | D | → |

Press Esc or close the window to exit. The player releases held buttons when the window loses focus.

Edit keybindings.conf to change the controls. Values must use sfml.js key names. Restart the player to apply changes.

Options

$ nes contra --scale 3
$ nes croom -f 60 -s 2
$ nes --help

| Option | Default | Description | | :--- | :---: | :--- | | -s, --scale | 2 | Scale the 256 × 240 frame; the default window is 512 × 480. | | -f, --frameRate | 60 | Emulation and display rate, from 10 to 240 fps. | | -h, --help | — | Show usage and exit. |

Use -f 60 for normal speed. This option controls emulation speed as well as the display rate, so increasing it also accelerates the game. Scale must be positive and produce whole-pixel window dimensions.

Development

To run from source:

$ git clone https://github.com/XadillaX/play-nes.git
$ cd play-nes
$ npm install
$ node bin/nes contra

$ npm install installs dependencies and compiles src/ into dist/. Run $ npm run build after changing TypeScript. Use $ npm link to register the local checkout as the nes command.

$ npm run check        # Check TypeScript types
$ npm run lint         # Run ESLint
$ npm test             # Build and run tests
$ npm run test:native  # Open each bundled ROM and check video, input and audio

We use audio consumption to pace emulation. JSNES runs in an audio Worker and advances when SFML requests more PCM samples. The main thread draws the latest complete frame, so rendering does not block audio generation.

The threads exchange video frames and controller state through shared memory. The main thread reuses its texture and sprite to limit allocation, then yields between frames so Node.js can process I/O. The implementation is in emulator.ts, shared-state.ts and game.ts.

Contributing

For bug reports, open an issue with the ROM name, operating system, Node.js version, reproduction steps and any error output. Pull requests are welcome.

MIT licensed.