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

@qubitcodes/qcreq

v1.0.1

Published

Unified, high-performance request parser and multi-format files extractor for Node.js and Next.js APIs.

Readme

@qubitcodes/qcreq

Unified, high-performance request parser and multi-format files extractor for Next.js (App Router, Edge Runtime, Serverless, Turbopack) and Node.js APIs.

Allows extracting route variables, query strings, and dynamic request bodies (supporting both strict JSON payloads and multipart files) into a clean, flat, and fully-typed QcRequest object.


Installation

npm install @qubitcodes/qcreq

Features

  • 🧬 Unified Extractor: Automatically merges params (route parameters), searchParams (query strings), and body/files into a single unified context.
  • 📁 Seamless File Upload Support: Automatically extracts multipart/form-data uploads into the .files property (supporting single and multi-file arrays) as raw standard File objects.
  • Edge & Turbopack Ready: Built with zero external dependencies to operate natively on standard Web APIs (NextRequest, File, FormData) under Serverless and Edge compilation.

API Reference

parseRequest

import { parseRequest, type QcRequest } from '@qubitcodes/qcreq';

const parsed: QcRequest = await parseRequest(
  req: NextRequest,
  paramsPromise?: Promise<Record<string, string>> | Record<string, string>
);

Returns QcRequest:

  • params: A record mapping route keys (e.g. [id]) to values.
  • searchParams: A record containing parsed query parameters.
  • body: A record containing the parsed JSON or form body key-value pairs.
  • files: A record containing uploaded files mapped to their form keys, holding either a single File object or an array of File objects.

Example Usage

Inside a Next.js API Route Controller (route.ts / Controller.ts)

import { NextRequest } from 'next/server';
import { parseRequest } from '@qubitcodes/qcreq';
import { resp } from '@qubitcodes/qcresp';

export async function POST(
	req: NextRequest,
	{ params }: { params: Promise<{ id: string }> }
) {
	try {
		// Parse routing variables, query strings, JSON payloads, and files in one go
		const parsed = await parseRequest(req, params);

		// 1. Access Route Params (e.g. /api/v1/enquiries/:id)
		const enquiryId = parsed.params.id;

		// 2. Access JSON/Form fields
		const { name, email, message } = parsed.body;

		// 3. Access uploaded files (e.g. avatar file)
		const avatarFile = parsed.files.avatar; // holds standard File / File[]
		
		if (avatarFile instanceof File) {
			console.log(`Processing file: ${avatarFile.name} (${avatarFile.size} bytes)`);
		}

		return resp.success('Request parsed successfully!', {
			enquiryId,
			fields: { name, email }
		});
	} catch (error) {
		return resp.failure('Failed to parse request.', 201);
	}
}

License

MIT License - Copyright (c) 2026 QubitCodes