#streaming
28 snippets tagged with #streaming
Multipart Upload Stream Handler
Handles multipart file uploads with streaming to disk without buffering the entire file in memory.
Best for: Large file uploads
Server-Sent Events Handler
Express route that implements SSE for real-time server-to-client push notifications.
Best for: Live notifications
JSON Stream Parser
Parses large JSON arrays from a readable stream without loading the entire file into memory.
Best for: Processing large log files
Streaming API Response
Stream long-running API responses using ReadableStream and TransformStream for real-time data delivery.
Best for: AI response streaming
Partial Prerendering with Suspense
Combine static shells with streamed dynamic content using React Suspense for instant page loads.
Best for: E-commerce product pages
Next.js Streaming with Suspense
Stream server components with Suspense boundaries for progressive page loading and better TTFB.
Best for: Progressive loading for data-heavy dashboards
Streaming with Loading UI and Suspense
Use loading.tsx and React Suspense to stream UI progressively in Next.js App Router.
Best for: dashboards
Streaming Response from Route Handler
Stream large responses from Next.js route handlers using ReadableStream for real-time data.
Best for: real-time updates
Generator Pipeline for Data Processing
Chain generators to build memory-efficient data processing pipelines for large files and streams.
Best for: Large file ETL
OpenAI Chat Completion with Streaming
Stream GPT responses token-by-token using the OpenAI SDK with async iteration.
Best for: chatbot UI
Next.js AI Streaming Route Handler
Stream OpenAI responses from a Next.js App Router route handler using the Vercel AI SDK.
Best for: AI chatbot backend
Google Gemini API Integration
Call the Google Gemini API for text generation with streaming, safety settings, and system prompts.
Best for: Google AI-powered code generation
Stream LLM Chat Responses
Stream OpenAI chat completions token-by-token for real-time UI updates.
Best for: Chat UIs
Ollama Local LLM Inference
Run local LLM inference using Ollama REST API with streaming and model management.
Best for: local development
Anthropic Streaming with Python
Stream Claude responses token by token using the Anthropic Python SDK with context manager.
Best for: streaming responses
OpenAI Realtime API WebSocket
Connect to the OpenAI Realtime API via WebSocket for low-latency voice and text streaming.
Best for: voice AI
Local LLM with Ollama Python Client
Run local open-source models with Ollama and stream responses using the Python API.
Best for: local AI
OpenAI Streaming with SSE in FastAPI
Stream OpenAI responses as Server-Sent Events from a FastAPI endpoint.
Best for: streaming AI APIs
LangChain Streaming Callback Handler
Capture LLM tokens as they stream using a custom callback handler for real-time UI updates.
Best for: streaming UI
HuggingFace Text Generation with Streaming
Run local text generation with HuggingFace models and stream output token-by-token to the console.
Best for: local LLM
Stream OpenAI Responses with Tool Calls
Handle streaming responses that include tool calls by accumulating delta chunks from the OpenAI API.
Best for: streaming tool calls
Python Streaming Data Processing
Process streaming data with generators, windowed aggregation, and memory-efficient line-by-line reading.
Best for: Processing large event log files efficiently
Kafka Consumer in Python — Stream Processing
Build a Kafka consumer in Python with offset management, error handling, and batch processing.
Best for: Real-time event processing from Kafka topics
Kafka Topic — Create and Manage with CLI
Create, describe, alter, and manage Kafka topics using the kafka-topics CLI with partitioning config.
Best for: Setting up Kafka topics for new data streams
Kafka Producer & Consumer in Python
Produce and consume JSON messages from Apache Kafka using the confluent-kafka Python client.
Best for: event streaming
PySpark Structured Streaming from Kafka
Consume a Kafka topic in real-time with PySpark Structured Streaming and write to Parquet.
Best for: real-time ETL
Streaming with fs2
Build composable streaming pipelines with fs2: chunks, transformations, concurrency, and resource safety.
Best for: Streaming data processing
Spark Structured Streaming
Process real-time data with Spark Structured Streaming: sources, transformations, and sinks.
Best for: Real-time event processing