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 🙏

© 2024 – Pkg Stats / Ryan Hefner

miniseed

v0.2.1

Published

miniSEED-ts is a Typescript implementation of the miniSEED V3 binary format.

Downloads

10

Readme

miniSEED-ts

miniSEED-ts is a Typescript implementation of the miniSEED V3 binary format.

You can read more about miniSEED here.

miniSEED-ts is powered by jDataView.

Installation

npm i miniseed

Typescript definitions are included.

Usage

import {
	serialiseToMiniSEEDBuffer,
	serialiseToMiniSEEDUint8Array,
	startTimeFromDate,
	Flags,
} from "miniseed";

const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];

const metadata = {
	sourceIdentifier: "FDSN:<network>_<station>_...", // An FDSN ID: http://docs.fdsn.org/projects/source-identifiers/
	// You can manually specify nanoseconds, seconds, etc
	startTime: {
		year: 1978,
		dayOfYear: 264,
		hour: 21,
		minute: 0,
		second: 0, // This needs to be an integer
		// There's no milliseconds field - they're included in nanoSecond
		nanoSecond: 0,
	},
	// Or use a helper function to convert from a Date object
	startTime: startTimeFromDate(new Date()),
	encoding: "Int32", // Or text, Int16, Float32, Float64

	// All other metadata fields are optional, but supported.
	// See the full list here https://docs.fdsn.org/projects/miniseed3/en/latest/definition.html#field-3

	// Flags can be binary OR'd together
	flags:
		Flags.CALIBRATION_SIGNALS_PRESENT |
		Flags.TIME_TAG_IS_QUESTIONABLE |
		Flags.CLOCK_LOCKED,
	sampleRatePeriod: 1.234,
	dataPublicationVersion: 1,
    extraHeaderFields: {
        // This gets turned into JSON
        "FDSN": {
            // This key is reserved
            // See more about this key here: https://docs.fdsn.org/projects/miniseed3/en/latest/fdsn-reserved.html#fdsn-reserved-headers
        }
        // Everything else is free game
        "beans": {
            // But you should still namespace your custom fields
            amount: 20000
        }
    }
};

console.log(serialiseToMiniSEEDUint8Array(data, metadata)); // Uint8Array
console.log(serialiseToMiniSEEDBuffer(data, metadata)); // ArrayBuffer

Notes

  • Only miniSEED version 3 is supported. Use mseedconvert to convert between V2 and V3.
  • Currently, only serialisation is supported. Deserialisation is planned
  • The various compression options offered by miniSEED aren't currently supported

Why not Streams

I wish I could use streams for this. Unfortunately, miniSEED requires a CRC hash of the whole record to be set in the headers. This means we can't start generating the response until we have all the data for the body.

Contributing

Contributions are welcome, especially fixes for things I might have done wrong.

Please write tests for anything you add.

mseed3-utils are very helpful for debugging and validating files.