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

pds2img

v0.1.0

Published

NASA Planetary Data System (PDS) to Image conversion library.

Readme

🛰️PDS2img

C3592903_RAW

NASA Planetary Data System (PDS) to PNG/TIFF conversion library.

Usage

PDS3 (Voyager, Galileo, Cassini, etc.)

import { loadPDS3ImageByUrl, toPNG, toTIFF } from 'pds2image';

const imgUrl = '/data/C3593229_RAW.IMG';

// Load and parse PDS3 product
const image = await loadPDS3ImageByUrl(imgUrl);

// Convert to PNG / TIFF ArrayBuffer
const pngBuffer = toPNG(image);
const tiffBuffer = toTIFF(image);

PDS4 (Modern spacecraft image)

import { loadPDS4ImageByUrl, toPNG, toTIFF } from 'pds2image';

const xmlUrl =
  '/data/FLG_1739_0821318674_675RAS_N0830000FHAZ00505_0A01I4J01.xml';
const imgUrl =
  '/data/FLG_1739_0821318674_675RAS_N0830000FHAZ00505_0A01I4J01.IMG';

// Load and parse PDS4 product
const image = await loadPDS4ImageByUrl(xmlUrl, imgUrl);

// Convert to PNG / TIFF ArrayBuffer
const pngBuffer = toPNG(image);
const tiffBuffer = toTIFF(image);

PDS4 (File System Access API)

import { loadPDSImageArrayBufferFromDirectory } from 'pds2image';

// Browser only: user picks a directory that contains .xml + referenced .IMG
const directoryHandle = await window.showDirectoryPicker();
const float32Buffer =
  await loadPDSImageArrayBufferFromDirectory(directoryHandle);

console.log(float32Buffer.byteLength);

Save PNG / TIFF in browser

function saveArrayBuffer(
  buffer: ArrayBuffer,
  mimeType: string,
  filename: string,
): void {
  const blob = new Blob([buffer], { type: mimeType });
  const url = URL.createObjectURL(blob);

  const anchor = document.createElement('a');
  anchor.href = url;
  anchor.download = filename;
  anchor.click();

  URL.revokeObjectURL(url);
}

// Example usage with previous PDS4 sample variables
saveArrayBuffer(pngBuffer, 'image/png', 'pds4-output.png');
saveArrayBuffer(tiffBuffer, 'image/tiff', 'pds4-output.tiff');

Save PNG / TIFF with user-selected location (File System Access API)

async function saveArrayBufferWithPicker(
  buffer: ArrayBuffer,
  mimeType: string,
  suggestedName: string,
): Promise<void> {
  // Fallback for browsers that do not support File System Access API
  if (!('showSaveFilePicker' in window)) {
    const blob = new Blob([buffer], { type: mimeType });
    const url = URL.createObjectURL(blob);

    const anchor = document.createElement('a');
    anchor.href = url;
    anchor.download = suggestedName;
    anchor.click();

    URL.revokeObjectURL(url);
    return;
  }

  const handle = await window.showSaveFilePicker({
    suggestedName,
    types: [
      {
        description: mimeType,
        accept: {
          [mimeType]: [suggestedName.endsWith('.tiff') ? '.tiff' : '.png'],
        },
      },
    ],
  });

  const writable = await handle.createWritable();
  await writable.write(buffer);
  await writable.close();
}

// Example usage with previous PDS4 sample variables
await saveArrayBufferWithPicker(pngBuffer, 'image/png', 'pds4-output.png');
await saveArrayBufferWithPicker(tiffBuffer, 'image/tiff', 'pds4-output.tiff');

CLI

# Build library first (CLI reads from dist/)
pnpm run build

# PDS3 example (creates C3592903_RAW.png)
bin/pds2img -i C3592903_RAW -type png

# Explicit input path and output path
bin/pds2img -i ./tests/data/C3592903_RAW -type tiff -o ./tests/data/out.tiff

# Directory mode: convert all supported datasets in a directory
bin/pds2img -d ./tests/data -type png

# Directory mode with explicit output directory
bin/pds2img -d ./tests/data -type tiff -o ./tests/out

Notes:

  • -i accepts a base path (C3592903_RAW), .IMG path, or .xml path.
  • -d converts all datasets in a directory: PDS3 (.IMG + .LBL) and PDS4 (.xml).
  • Detection order for base path input is PDS3 (.IMG + .LBL) then PDS4 (.xml).
  • In directory mode, -o is treated as an output directory.
  • On Windows PowerShell, run ./bin/pds2img.cmd ....

Setup

Install the dependencies:

pnpm install

Get started

Build the app for production:

pnpm run build

License

©2026 by Logue. Licensed under the MIT License.