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

@chickenneo/sweph

v3.6.9

Published

Swiss Ephemeris native bindings for Node.js (Linux x64, ESM + CommonJS)

Readme

@chickenneo/sweph

Swiss Ephemeris for Node.js as a single prebuilt native addon for Linux x64, with the ephemeris data files compiled into the binary.

  • Nothing to download, no data files to ship, no set_ephe_path to configure
  • No install scripts, no build step, no dependencies
  • Works with both ESM (import) and CommonJS (require)
  • Full TypeScript types for all 104 functions and 325 constants
  • Swiss Ephemeris 2.10.03

Requirements

| | | |---|---| | OS | Linux | | Architecture | x64 | | libc | glibc 2.38 or newer | | Node.js | 20 or newer |

The addon is prebuilt and loaded directly, so no compiler is needed. Other platforms are not supported.

glibc 2.38 means Debian 13, Ubuntu 24.04 or a comparably recent distribution; in Docker, a trixie or noble based Node image. Older bases such as node:22-bookworm (glibc 2.36), Ubuntu 22.04, RHEL 9 or Amazon Linux 2023 are too old, and Alpine does not ship glibc at all. The package declares "os", "cpu" and "libc", so npm and pnpm refuse to install it on a platform it cannot run on, rather than failing later at load time.

Building the addon on an older distribution lowers this requirement; the limit comes from the machine the binary was compiled on, not from the code.

Usage

import sweph from "@chickenneo/sweph";
// or: const sweph = require("@chickenneo/sweph");

const { constants: c } = sweph;

const date = sweph.utc_to_jd(2026, 9, 15, 12, 0, 0, c.SE_GREG_CAL);
if (date.flag !== c.OK) throw new Error(date.error);

const [jd_et, jd_ut] = date.data;
const moon = sweph.calc_ut(jd_ut, c.SE_MOON, c.SEFLG_SWIEPH | c.SEFLG_SPEED);

console.log(moon.data[0]); // longitude in degrees

Named imports work as well:

import { calc_ut, constants, set_ephe_path } from "@chickenneo/sweph";

Swiss Ephemeris keeps global state. Settings such as set_sid_mode and set_topo stay in effect for every later call, which matters in a server that handles many requests.

Ephemeris data

These files are compiled into the addon and are always available:

| File | Covers | |---|---| | sepl_18.se1 | planets, 1800–2399 | | semo_18.se1 | the Moon, 1800–2399 | | seas_18.se1 | asteroids such as Chiron and Ceres | | sefstars.txt | fixed stars (fixstar*) | | seorbel.txt | fictitious bodies |

Calling set_ephe_path() is therefore not required. Requests for any of the files above are served from memory; anything else, such as sedeltat.txt or a JPL file, is still read from the path if one is set. To use different data, for example ephemerides covering years outside 1800–2399, place those files in a folder and pass it to set_ephe_path() — note that files with the names above will still be served from the embedded copies.

Documentation

The API mirrors the C library one to one. See the official programmer's documentation for what each function does; parameter and return-value descriptions are also available inline through the bundled TypeScript types.

License

This package is licensed under AGPL-3.0-or-later. See LICENSE.

Swiss Ephemeris itself is dual licensed by Astrodienst AG under either the AGPL or the Swiss Ephemeris Professional License. The choice has to be made before distributing software that contains it, and before running a public service built on it. Note that the AGPL applies to network services as well: if this package is used in a server that users interact with over a network, that server's source code has to be made available under the AGPL, unless a professional license has been purchased.

Source code and building

The complete source for the published binary is in this repository: the Swiss Ephemeris C library in swisseph/, the N-API bindings in src/, the ephemeris data in ephe/, and the build scripts in tools/.

Swiss Ephemeris is modified here in exactly one place. In swisseph/sweph.c, swi_fopen() first asks swi_fopen_embedded() (generated into src/embedded_ephe.c by tools/gen_embedded.js) for the requested file and, when it is one of the embedded ones, returns a read-only FILE * over the in-memory copy through fmemopen(). Everything else is unchanged, which is why glibc is required.

To rebuild:

npm install     # node-gyp and node-addon-api
npm run build   # generates sources, compiles, updates ./sweph.node
npm test        # verifies the embedded data is what gets used

Credits

  • Swiss Ephemeris — Copyright © 1997–2021 Astrodienst AG, Switzerland. Authors: Dieter Koch and Alois Treindl.
  • sweph — the N-API bindings this package is based on, Copyright © 2021–2026 Timotej Valentin Rojko.