id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id
title
category
status
canonical_id
aliases
duplicate_of
source_trust_level
confidence_score
verification_status
tags
raw_sources
last_reinforced
github_commit
tech_stack
wiki-2026-0508-스트림-stream
스트림(Stream)
10_Wiki/Topics
verified
self
none
A
0.95
applied
2026-05-10
pending
language
framework
typescript
nodejs
스트림(Stream)
매 한 줄
"매 데이터를 chunk 단위로 점진 전달한다" . 매 entire payload 를 buffer 에 fully load 하지 않고, 매 사용 가능한 시점마다 chunk 를 yield → 매 memory footprint 감소 + first-byte latency 개선. 매 modern web (Server-Sent Events · LLM token streaming · HTTP/2 push) 의 backbone.
매 핵심
매 Stream 의 종류
Readable : pull-based source (file read, HTTP response).
Writable : push-based sink (file write, response.write).
Duplex : read + write (TCP socket).
Transform : read → mutate → write (gzip, JSON.parse).
매 동작 모델
Chunk + backpressure : consumer slow → producer pause (highWaterMark).
Object mode : chunk 가 raw bytes 가 아닌 object.
Pipe : source.pipe(transform).pipe(sink) chain.
매 응용
LLM token streaming (Claude · GPT-5 의 SSE response).
Large file upload/download (Multipart, S3 multipart).
Real-time analytics (Kafka consumer).
💻 패턴
Web Streams API (cross-platform)
Async iteration over Node stream
Transform stream — gzip on the fly
Server-Sent Events (LLM token stream)
ReadableStream from generator
Backpressure handling
매 결정 기준
상황
Approach
Browser fetch streaming
Web Streams API (response.body)
Node.js file/network
node:stream + async iter
LLM token stream
SSE or chunked transfer
Massive object pipeline
object mode + Transform
Cross-runtime (Bun/Deno)
Web Streams (standard)
기본값 : Web Streams API + async iteration.
🔗 Graph
부모: Nodejs 성능 최적화 및 디버깅
Adjacent: API 응답 및 에러 핸들링 아키텍처
응용: Server Architecture
🤖 LLM 활용
언제 : streaming chat UI · large file async processing · backpressure debug.
언제 X : small payload (<1MB) — buffering 이 simpler.
❌ 안티패턴
Concat all chunks before yielding : stream 의 의미 무효화.
Ignore backpressure : producer 가 consumer 추월 → memory blow up.
No error propagation in pipe : 한 stage error 가 silent.
Sync transform on huge object : event loop block.
🧪 검증 / 중복
Verified (Node.js docs · WHATWG Streams Standard).
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — Stream API 패턴 정리