Code Explainers

Code explainers tagged #streaming

python
from collections import defaultdict
from datetime import datetime
from openpyxl import load_workbook
 

Summarizing an Excel sheet with openpyxl

excel-parsing aggregation type-dispatch
Intermediate 7 steps
python
import csv
 
from django.http import StreamingHttpResponse
from django.utils.timezone import now

Streaming a CSV export in Django

streaming csv-export generators
Intermediate 7 steps
java
@RestController
@RequestMapping("/api/notifications")
public class NotificationStreamController {
 

Server-Sent Events per user in Spring

server-sent-events concurrency event-driven
Advanced 8 steps
rust
use std::io::{BufRead, BufReader};
use std::process::{Command, Stdio};
 
#[derive(Debug)]

Parsing ps output into structs in Rust

subprocess parsing iterators
Intermediate 8 steps
java
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;

Streaming a file download with Java's HttpClient

http-client streaming file-io
Intermediate 6 steps
python
import csv
from pathlib import Path
 
 

Splitting a large CSV into smaller files

file-io streaming csv
Intermediate 8 steps
php
<?php
 
namespace App\Http\Controllers;
 

Streaming job progress with SSE in Laravel

server-sent-events streaming polling
Advanced 8 steps
go
type SensorReading struct {
	DeviceID    string    `json:"device_id" binding:"required"`
	Temperature float64   `json:"temperature"`
	RecordedAt  time.Time `json:"recorded_at" binding:"required"`

Streaming NDJSON ingestion in Gin

streaming batching json-decoding
Advanced 10 steps
python
import hashlib
from pathlib import Path
 
 

Streaming SHA-256 checksums in Python

hashing file-io streaming
Intermediate 6 steps
python
import ijson
from decimal import Decimal
 
 

Streaming JSON aggregation with ijson

streaming json-parsing generators
Intermediate 7 steps
javascript
import { Suspense } from 'react';
import { getProducts } from '@/lib/api/products';
import { formatPrice } from '@/lib/format';
 

Streaming a product list with Suspense in Next.js

server-components suspense streaming
Intermediate 8 steps
java
@Component
@Order(20)
public class ProductSearchIndexRunner implements ApplicationRunner {
 

Rebuilding a search index at Spring startup

startup-hook batching streaming
Intermediate 8 steps
javascript
const express = require('express');
const compression = require('compression');
const zlib = require('zlib');
 

Tuning Express response compression

compression middleware http
Intermediate 9 steps
go
package feed
 
import (
	"encoding/json"

Streaming a JSON array in Go

streaming json decoder
Intermediate 6 steps
rust
use axum::{extract::Multipart, http::StatusCode, Json};
use serde::Serialize;
use tokio::io::AsyncWriteExt;
use uuid::Uuid;

Streaming multipart uploads in Axum

multipart streaming async-io
Intermediate 10 steps
python
import shutil
import uuid
from pathlib import Path
 

Safe avatar uploads in FastAPI

file-upload validation streaming
Intermediate 8 steps
php
<?php
 
namespace App\Http\Controllers;
 

Streaming a large CSV export in Laravel

streaming csv-export memory-efficiency
Intermediate 9 steps
python
import csv
import io
from datetime import datetime
 

Streaming a CSV export in Flask

streaming generators csv
Intermediate 9 steps