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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@milaboratories/pframes-rs-serv

v1.0.109

Published

PFrames - Node.js HTTP(S) Parquet Server

Downloads

2,349

Readme

@milaboratories/pframes-serv

A high-performance HTTP server for serving Parquet files with full RFC 9110 compliance, authentication support, and optimized caching.

Overview

This package provides HTTP(S) server functionality for the PFrames ecosystem, specifically designed for serving Parquet files with proper HTTP semantics. It implements a complete HTTP/1.1 server that handles range requests, conditional requests, Bearer token authentication, and range requests caching.

Architecture

Core Components

  • Server (src/serve.ts) - Generic HTTP server with lifecycle management and optional authentication
  • HTTP Handler (src/handler.ts) - RFC 9110 compliant HTTP request handler with object store integration
  • File System Store (src/fs-store.ts) - Object store implementation for local filesystem

Exports

Public API

  • serve() - Main server function
  • createRequestHandler() - HTTP request handler factory
  • FileSystemStore - Local file system object store implementation

The HttpHelpers export contains functions intended for re-export through the @milaboratories/pframes-rs-node package.

Binary Script

The bin/parquet-server.mjs script can be used for integration testing. It provides a standalone server that can be spawned programmatically and serve Parquet files over HTTP(S) from a local directory.

HTTP Handler Flow

The request handler implements a complete HTTP/1.1 server following RFC 9110 (HTTP Semantics) and RFC 9111 (HTTP Caching). The handler consists of two layers:

  1. Authorization Layer (authorizeRequestHandler) - Optional Bearer token authentication
  2. Core Handler (handleRequest) - Main HTTP processing logic

Request Processing Flow

┌─────────────────┐
│ Request Arrives │
└─────────┬───────┘
          │
          ▼
┌─────────────────────┐
│ Set Default Headers │ ← Content-Length: 0, Date: now
│ (All Responses)     │
└─────────┬───────────┘
          │
          ▼
┌─────────────────────┐    [FAIL] Invalid/Missing Token
│ Check Bearer Token  │────────────┐
│ (Timing-Safe)       │            │
└─────────┬───────────┘            │
          │ [PASS] Valid Token     ▼
          │                ┌──────────────┐
          │                │ Return 401   │ ← WWW-Authenticate: Bearer
          │                │ Unauthorized │
          ▼                └──────────────┘
┌─────────────────────┐
│ Set Cache Control   │ ← Cache-Control: public, max-age=31536000
│ Headers             │
└─────────┬───────────┘
          │
          ▼
┌─────────────────────┐    [FAIL] Not GET/HEAD
│ Check HTTP Method   │────────────┐
└─────────┬───────────┘            │
          │ [PASS] GET or HEAD     │
          ▼                        ▼
┌─────────────────────┐    ┌──────────────┐
│ Parse URL &         │    │ Return 405   │ ← Allow: GET, HEAD
│ Extract Filename    │    │ Not Allowed  │
└─────────┬───────────┘    └──────────────┘
          │
          ▼
┌─────────────────────┐    [FAIL] Invalid Pattern
│ Validate .parquet   │────────────┐
│ Extension           │            │
└─────────┬───────────┘            │
          │ [PASS] Valid .parquet  │
          ▼                        ▼
┌─────────────────────┐    ┌──────────────┐
│ Set Content Headers │    │ Return 410   │
│ (Accept-Ranges,     │    │ Gone         │
│  Content-Type),     │    └──────────────┘
│ Generate ETag &     │ ← ETag from filename
│ Set Cache Headers   │   Last-Modified: UTC(0)
└─────────┬───────────┘
          │
          ▼
┌─────────────────────┐    [FAIL] Precondition Failed
│ Check If-Match &    │────────────┐
│ If-Unmodified-Since │            │
└─────────┬───────────┘            │
          │                        │
          ▼                        ▼
┌─────────────────────┐    ┌─────────────────────┐
│ Check If-None-Match │    │ Return 412          │
│ & If-Modified-Since │    │ Precondition Failed │
└─────────┬───────────┘    └─────────────────────┘
          │ [FAIL] Not Modified
          ├────────────────────────┐
          │                        ▼
          │                ┌──────────────┐
          │                │ Return 304   │
          │                │ Not Modified │
          │                └──────────────┘
          ▼
┌─────────────────────┐    [FAIL] Invalid Range
│ Parse Range Header  │────────────┐
└─────────┬───────────┘            │
          │ [PASS] Valid Range     │
          ▼                        ▼
┌─────────────────────┐    ┌──────────────┐
│ Proxy Request to    │    │ Return 400   │
│ Object Store        │    │ Bad Request  │
└─────────┬───────────┘    └──────────────┘
          │
          ├─────────┬─────────┬─────────┐
          │         │         │         │
          ▼         ▼         ▼         ▼
      ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
      │  Ok   │ │  Not  │ │Invalid│ │ Server│
      │Success│ │ Found │ │ Range │ │ Error │
      └───┬───┘ └───┬───┘ └───┬───┘ └───┬───┘
          │         │         │         │
          ▼         ▼         ▼         ▼
      ┌───────┐ ┌───────┐ ┌───────┐ ┌───────┐
      │200/206│ │ 404   │ │ 416   │ │ 500   │
      └───┬───┘ └───────┘ └───────┘ └───────┘
          │
          ▼
┌─────────────────────┐
│ Set Content-Length  │ ← Full size or range size
│ & Content-Range     │   Content-Range for 206 responses
└─────────┬───────────┘
          │
          ▼
┌─────────────────────┐    [HEAD] Headers Only
│ Check Request       │────────────┐
│ Method              │            │
└─────────┬───────────┘            │
          │ [GET] Send Body        │
          ▼                        ▼
┌─────────────────────┐    ┌──────────────┐
│ Stream File Content │    │ Send Headers │
└─────────────────────┘    └──────────────┘