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

hips2fits-js

v0.1.4

Published

Simple utility for requesting data from the CDS hips2fits service.

Readme

hips2fits-js

hips2fits-js

Simple utility for requesting data from the CDS hips2fits service.

This package provides both ES and CJS module formats.

It is ES5 compatible, however it does not provide any polyfills.

It's a simple setup - Use the getImage or getImageUrl functions, which take the HipsOptions object.

Documentions on the service can be found here.

alt text

Installation

npm i -S hips2fits-js

Index

Enumerations

Interfaces

Functions

Functions

getImage

getImage(options: HipsOptions, endPoint?: string): Promise‹Uint8Array›

Defined in get-image.ts:59

Get an image from the hips2fits service.

example

const { writeFile } = require("fs").promises;

const {
  getImage,
  HipsImageFormat,
  HipsProjection,
  HipsService,
  HipsStretch,
  HipsCoordsys,
} = require("hips2fits-js");

(async function () {
  let data;

  try {
    data = await getImage({
      hips: HipsService.CDS_P_DSS2_color,
      coordsys: HipsCoordsys.Icrs,
      projection: HipsProjection.Car,
      stretch: HipsStretch.Asinh,
      format: HipsImageFormat.Png,
      width: 2048 / 4,
      height: 1024 / 4,
      ra: 0,
      dec: 0,
      fov: 360,
    });

    await writeFile("image.png", data);
  } catch (error) {
    console.log(error);
    return;
  }

})();

Parameters:

Name | Type | Description | ------ | ------ | ------ | options | HipsOptions | Options object configuring the Hips image generated. | endPoint? | string | Base URL endpoint. |

Returns: Promise‹Uint8Array›


getImageUrl

getImageUrl(options: HipsOptions, endPoint: string): string

Defined in get-image-url.ts:56

Get an image URL from the hips2fits service.

example

import {
  getImageUrl,
  HipsImageFormat,
  HipsProjection,
  HipsService,
  HipsStretch,
  HipsCoordsys,
} from "hips2fits-js";

let url;
let width = 1024;
let height = 512;

url = getImageUrl({
  hips: HipsService.CDS_P_DSS2_color,
  coordsys: HipsCoordsys.Icrs,
  projection: HipsProjection.Car,
  stretch: HipsStretch.Asinh,
  format: HipsImageFormat.Png,
  width,
  height,
  ra: 0,
  dec: 0,
  fov: 360,
});

let img = new Image();
img.width = width;
img.height = height;
img.src = url;

window.addEventListener("load", function () {
  window.document.body.appendChild(img);
});

Parameters:

Name | Type | Default | Description | ------ | ------ | ------ | ------ | options | HipsOptions | - | Options object configuring the Hips image generated. | endPoint | string | DEFAULT_ENDPOINT | Base URL endpoint. |

Returns: string


parseWcs

parseWcs(wcsString: string): WcsDict

Defined in parse-wcs.ts:30

Parse a WCS configuration string.

example

let wcs = `
NAXIS1  =                 2000
NAXIS2  =                 1000
WCSAXES =                    2 / Number of coordinate axes
CRPIX1  =               1000.0 / Pixel coordinate of reference point
CRPIX2  =                500.0 / Pixel coordinate of reference point
CDELT1  =                -0.18 / [deg] Coordinate increment at reference point
CDELT2  =                 0.18 / [deg] Coordinate increment at reference point
CUNIT1  = 'deg'                / Units of coordinate increment and value
CUNIT2  = 'deg'                / Units of coordinate increment and value
CTYPE1  = 'GLON-MOL'           / galactic longitude, Mollweide's projection
CTYPE2  = 'GLAT-MOL'           / galactic latitude, Mollweide's projection
CRVAL1  =                  0.0 / [deg] Coordinate value at reference point
CRVAL2  =                  0.0 / [deg] Coordinate value at reference point
`;

let wcsDict = parseWcs(wcs);

Parameters:

Name | Type | Description | ------ | ------ | ------ | wcsString | string | |

Returns: WcsDict