7 snippets · production-ready JavaScript & TypeScript
Production-ready TypeScript utilities for reading JSON files with Zod schema validation and writing JSON files atomically using temporary files and rename operations.
An async generator function that recursively traverses a directory tree, yielding file paths that match include/exclude glob patterns with configurable maximum depth.
A complete TypeScript implementation for gracefully shutting down Node.js HTTP servers, handling OS signals, tracking in-flight requests, and ensuring all connections complete before exit.
A production-ready TypeScript implementation of a Node.js stream pipeline that processes large CSV files efficiently using stream/promises pipeline(), custom Transform streams for parsing and filtering, with proper error handling and backpressure support.
A complete HTTP client implementation using Node.js built-in http and https modules, featuring typed responses, automatic JSON handling, redirect following, and configurable timeouts.
A production-ready TypeScript utility that wraps child_process.spawn to execute shell commands, stream output to the console in real-time, and return the exit code via a Promise.
A TypeScript utility that validates environment variables against a Zod schema at application startup, providing type-safe access to env vars and clear error messages when validation fails.