mzPeak.ts - Reading mzPeak files in the browser and server with JavaScript

What is this?

This is an implementation of mzPeak that reads data in the browser and over the network. It provides (relatively) fast random access over data files, and handles quick access to metadata on-demand. All processing happens within the client, no backend server needed.

This is not a wrapper around an implementation in another language. This uses pre-existing JavaScript and WASM libraries to work with ZIP, Parquet, and Arrow, with all the gory details of mzPeak implemented directly in TypeScript. This work would not have been possible without:

  1. parquet-wasm: https://github.com/kylebarron/parquet-wasm
  2. apache-arrow: https://arrow.apache.org/js/current/
  3. zip.js: https://github.com/gildas-lormeau/zip.js/

Demo

Try out the demo application for reading mzPeak files and visualizing their contents

Example files

Usage

import { MzPeakReader, Spectrum } from "mzpeakts"

// Use the current window's context to find the file relative to this page.
const reader = await MzPeakReader.fromUrl("static/small.mzpeak")

const spec: Spectrum = await reader.getSpectrum(0)
console.log(spec.id, spec.index, spec.dataArrays)