oven-sh/bun
요약
Bun은 JavaScript 및 TypeScript 앱을 위한 올인원 툴킷으로, 단일 실행 파일 `bun` 형태로 제공됩니다. 핵심은 Node.js를 대체하도록 설계된 빠른 Zig 기반의 Bun runtime이며, 이는 시작 시간과 메모리 사용량을 크게 줄였습니다. 이 도구는 테스트 러너, 스크립트 러너, 그리고 Node.js와 호환되는 패키지 매니저 등 개발에 필요한 모든 기능을 통합하여 기존 프로젝트에서 빠르고 쉽게 사용할 수 있도록 합니다.
핵심 포인트
- Bun은 JavaScript/TypeScript 앱을 위한 올인원 툴킷이며 단일 실행 파일로 제공됩니다.
- 핵심 Bun runtime은 Zig로 작성되었으며, Node.js 대비 빠른 성능과 낮은 메모리 사용량을 자랑합니다.
- 패키지 매니저, 테스트 러너, 스크립트 러너 등 개발에 필요한 모든 도구를 통합했습니다.
- 기존 Node.js 프로젝트에서 거의 변경 없이 사용할 수 있도록 호환성을 유지하면서도 속도를 크게 향상시켰습니다.
Bun은 JavaScript 및 TypeScript 앱을 위한 올인원 (all-in-one) 툴킷입니다. bun이라 불리는 단일 실행 파일로 제공됩니다.
그 핵심에는 Node.js를 즉시 대체할 수 있도록 설계된 빠른 JavaScript 런타임인 Bun runtime이 있습니다. 이는 Zig로 작성되었으며 내부적으로 JavaScriptCore를 사용하여 시작 시간과 메모리 사용량을 획기적으로 줄였습니다.
bun run index.tsx # TS 및 JSX를 별도 설정 없이 지원
bun 명령줄 도구(command-line tool)는 테스트 러너 (test runner), 스크립트 러너 (script runner), 그리고 Node.js와 호환되는 패키지 매니저 (package manager)도 구현합니다. 개발을 위해 1,000개의 node_modules가 필요한 대신, bun 하나만 있으면 됩니다. Bun의 내장 도구들은 기존 옵션들보다 현저히 빠르며, 기존 Node.js 프로젝트에서 거의 또는 전혀 변경 없이 사용할 수 있습니다.
bun test # 테스트 실행
bun run start # `package.json`의 `start` 스크립트 실행
bun install <pkg> # 패키지 설치
...
Bun은 Linux (x64 & arm64), macOS (x64 & Apple Silicon), 그리고 Windows (x64 & arm64)를 지원합니다.
Linux 사용자 — 커널 (Kernel) 버전 5.6 이상을 강력히 권장하지만, 최소 버전은 5.1입니다.
x64 사용자 — "illegal instruction" 또는 유사한 오류가 발생하는 경우, 당사의 CPU 요구 사항을 확인하십시오.
# 설치 스크립트 사용 (권장)
curl -fsSL https://bun.com/install | bash
# Windows에서
...
Bun을 최신 버전으로 업그레이드하려면 다음을 실행하십시오:
bun upgrade
Bun은 main 브랜치에 커밋될 때마다 canary 빌드를 자동으로 출시합니다. 최신 canary 빌드로 업그레이드하려면 다음을 실행하십시오:
bun upgrade --canary
소개 (Intro)
템플릿 (Templating)
런타임 (Runtime)
패키지 매니저 (Package manager)
번들러 (Bundler)
테스트 러너 (Test runner)
패키지 러너 (Package runner)
API
-
HTTP 서버 (
Bun.serve) - HTTP 라우팅 (HTTP routing) -
HTTP 에러 핸들링 (HTTP error handling)
-
HTTP 메트릭 (HTTP metrics)
-
WebSockets
-
Workers
-
바이너리 데이터 (Binary data)
-
스트림 (Streams)
-
파일 I/O (
Bun.file) - 아카이브 (Archive, tar) -
SQLite (
bun:sqlite) - PostgreSQL (Bun.sql) - Redis (Bun.redis) - S3 클라이언트 (S3 Client,Bun.s3) - FileSystemRouter -
TCP 소켓 (TCP sockets)
-
UDP 소켓 (UDP sockets)
-
전역 변수 (Globals)
-
자식 프로세스 (Child processes, spawn)
-
Cron (
Bun.cron) - WebView -
트랜스파일러 (Transpiler,
Bun.Transpiler) -
해싱 (Hashing)
-
색상 (
Bun.color) -
콘솔 (Console)
-
FFI (
bun:ffi) -
C 컴파일러 (
bun:fficc) -
HTMLRewriter
-
쿠키 (
Bun.Cookie) -
CSRF (
Bun.CSRF) -
비밀값 (
Bun.secrets) -
YAML (
Bun.YAML) -
TOML (
Bun.TOML) -
JSON5
-
JSONL
-
마크다운 (Markdown)
-
이미지 처리 (Image processing)
-
유틸리티 (Utils)
-
Node-API
-
Glob (
Bun.Glob) -
Semver (
Bun.semver) -
DNS
-
fetch API 확장 (fetch API extensions)
-
HTTP 서버 (HTTP server)
-
배포 (Deployment)
-
바이너리 (Binary)
-
Blob을 문자열로 변환 (Convert a Blob to a string)
-
Buffer를 blob으로 변환 (Convert a Buffer to a blob)
-
Blob을 DataView로 변환 (Convert a Blob to a DataView)
-
Buffer를 문자열로 변환 (Convert a Buffer to a string)
-
Blob을 ReadableStream으로 변환 (Convert a Blob to a ReadableStream)
-
Blob을 Uint8Array로 변환 (Convert a Blob to a Uint8Array)
-
DataView를 문자열로 변환 (Convert a DataView to a string)
-
Uint8Array를 Blob으로 변환 (Convert a Uint8Array to a Blob)
-
Blob을 ArrayBuffer로 변환 (Convert a Blob to an ArrayBuffer)
-
ArrayBuffer를 Blob으로 변환 (Convert an ArrayBuffer to a Blob)
-
Buffer를 Uint8Array로 변환 (Convert a Buffer to a Uint8Array)
-
Uint8Array를 Buffer로 변환 (Convert a Uint8Array to a Buffer)
-
Uint8Array를 문자열로 변환 (Convert a Uint8Array to a string)
-
Buffer를 ArrayBuffer로 변환 (Convert a Buffer to an ArrayBuffer)
-
ArrayBuffer를 Buffer로 변환 (Convert an ArrayBuffer to a Buffer)
-
ArrayBuffer를 문자열로 변환 (Convert an ArrayBuffer to a string)
-
Uint8Array를 DataView로 변환 (Convert a Uint8Array to a DataView)
-
Buffer를 ReadableStream으로 변환 (Convert a Buffer to a ReadableStream)
-
Uint8Array를 ArrayBuffer로 변환 (Convert a Uint8Array to an ArrayBuffer)
-
ArrayBuffer를 Uint8Array로 변환 (Convert an ArrayBuffer to a Uint8Array)
-
ArrayBuffer를 숫자 배열로 변환 (Convert an ArrayBuffer to an array of numbers)
-
Uint8Array를 ReadableStream으로 변환 (Convert a Uint8Array to a ReadableStream)
-
생태계 (Ecosystem)
-
React 및 JSX 사용
-
Bun과 함께 Gel 사용
-
Bun과 함께 Prisma 사용
-
Bun과 함께 Prisma Postgres 사용
-
Bun 앱에 Sentry 추가
-
Discord 봇 만들기
-
PM2를 사용하여 Bun을 데몬 (Daemon)으로 실행
-
Bun과 함께 Drizzle ORM 사용
-
Bun과 함께 Upstash Redis 사용
-
Nuxt와 Bun으로 앱 구축
-
Qwik와 Bun으로 앱 구축
-
Astro와 Bun으로 앱 구축
-
Remix와 Bun으로 앱 구축
-
Vite와 Bun을 사용하여 프론트엔드 구축
-
Next.js와 Bun으로 앱 구축
-
systemd를 사용하여 Bun을 데몬 (Daemon)으로 실행
-
Hono와 Bun을 사용하여 HTTP 서버 구축
-
SvelteKit와 Bun으로 앱 구축
-
SolidStart와 Bun으로 앱 구축
-
TanStack Start와 Bun으로 앱 구축
-
Elysia와 Bun을 사용하여 HTTP 서버 구축
-
StricJS와 Bun을 사용하여 HTTP 서버 구축
-
Docker로 Bun 애플리케이션 컨테이너화 (Containerize)
-
Express와 Bun을 사용하여 HTTP 서버 구축
-
Drizzle ORM을 통해 Neon Postgres 사용
-
React 컴포넌트 서버 사이드 렌더링 (SSR)
-
Mongoose와 Bun을 사용하여 MongoDB에 데이터 읽기 및 쓰기
-
Bun과 함께 Neon의 Serverless Postgres 사용
HTMLRewriter
HTTP
-
HTTP 서버 핫 리로드 (Hot reload)
-
일반적인 HTTP 서버 사용법
-
간단한 HTTP 서버 작성
-
HTTP 서버에 TLS 설정
-
fetch를 사용하여 HTTP 요청 보내기
-
fetch()를 사용하여 HTTP 요청 프록시 (Proxy)
-
HTTP 서버 클러스터 (Cluster) 시작
-
파일을 HTTP 응답 (Response)으로 스트리밍 (Stream)
-
Bun에서 유닉스 도메인 소켓 (Unix domain sockets)을 사용한 fetch
-
FormData를 사용하여 HTTP를 통해 파일 업로드
-
비동기 반복자 (Async Iterators)를 사용한 스트리밍 HTTP 서버
-
Node.js 스트림 (Streams)을 사용한 스트리밍 HTTP 서버
-
Bun을 사용한 서버 전송 이벤트 (Server-Sent Events, SSE)
설치 (Install)
-
의존성 추가 (Add a dependency)
-
Git 의존성 추가 (Add a Git dependency)
-
피어 의존성 추가 (Add a peer dependency)
-
신뢰할 수 있는 의존성 추가 (Add a trusted dependency)
-
개발 의존성 추가 (Add a development dependency)
-
tarball 의존성 추가 (Add a tarball dependency)
-
선택적 의존성 추가 (Add an optional dependency)
-
yarn 호환 잠금 파일 (lockfile) 생성 (Generate a yarn-compatible lockfile)
-
워크스페이스 (workspaces)를 사용한 모노레포 (monorepo) 설정 (Configuring a monorepo using workspaces)
-
다른 이름으로 패키지 설치 (Install a package under a different name)
-
GitHub Actions에서 Bun으로 의존성 설치 (Install dependencies with Bun in GitHub Actions)
-
Artifactory와 함께 bun install 사용하기 (Using bun install with Artifactory)
-
Bun의 lockb 잠금 파일을 diff 하기 위해 git 설정하기 (Configure git to diff Bun's lockb lockfile)
-
bun install을 위한 기본 npm 레지스트리 (registry) 재정의 (Override the default npm registry for bun install)
-
Azure Artifacts npm 레지스트리와 함께 bun install 사용하기 (Using bun install with an Azure Artifacts npm registry)
-
npm install에서 bun install로 마이그레이션 (Migrate from npm install to bun install)
-
bun install을 사용하여 조직 스코프 (organization scope)를 위한 프라이빗 레지스트리 (private registry) 설정 (Configure a private registry for an organization scope with bun install)
프로세스 (Process)
파일 읽기 (Read file)
런타임 (Runtime)
-
파일 삭제 (Delete files)
-
셸 명령 실행 (Run a Shell Command)
-
JSON 파일 임포트 (Import a JSON file)
-
TOML 파일 임포트 (Import a TOML file)
-
YAML 파일 임포트 (Import a YAML file)
-
JSON5 파일 임포트 (Import a JSON5 file)
-
Bun에서 시간대 (time zone) 설정 (Set a time zone in Bun)
-
환경 변수 설정 (Set environment variables)
-
임포트 경로 재매핑 (Re-map import paths)
-
디렉토리 삭제 (Delete directories)
-
환경 변수 읽기 (Read environment variables)
-
HTML 파일을 텍스트로 임포트 (Import a HTML file as text)
-
GitHub Actions에서 Bun 설치 및 실행 (Install and run Bun in GitHub Actions)
-
웹 디버거 (web debugger)로 Bun 디버깅 (Debugging Bun with the web debugger)
-
Bun을 위한 TypeScript 선언 설치 (Install TypeScript declarations for Bun)
-
VS Code 확장 프로그램을 사용한 Bun 디버깅 (Debugging Bun with the VS Code extension)
-
V8 힙 스냅샷 (heap snapshots)을 사용한 메모리 사용량 조사 (Inspect memory usage using V8 heap snapshots)
-
정적 전역 변수 및 상수 정의 및 교체 (Define and replace static globals & constants)
-
--define을 사용한 빌드 타임 상수 (Build-time constants with --define)
-
macOS에서 단일 파일 JavaScript 실행 파일 코드 서명 (Codesign a single-file JavaScript executable on macOS)
스트림 (Streams)
-
ReadableStream을 JSON으로 변환 (Convert a ReadableStream to JSON)
-
ReadableStream을 Blob으로 변환 (Convert a ReadableStream to a Blob)
-
ReadableStream을 Buffer로 변환 (Convert a ReadableStream to a Buffer)
-
ReadableStream을 문자열로 변환 (Convert a ReadableStream to a string)
-
ReadableStream을 Uint8Array로 변환 (Convert a ReadableStream to a Uint8Array)
-
ReadableStream을 청크 (chunks) 배열로 변환 (Convert a ReadableStream to an array of chunks)
-
Node.js Readable을 JSON으로 변환 (Convert a Node.js Readable to JSON)
-
ReadableStream을 ArrayBuffer로 변환 (Convert a ReadableStream to an ArrayBuffer)
-
Node.js Readable을 Blob으로 변환 (Convert a Node.js Readable to a Blob)
-
Node.js Readable을 문자열로 변환 (Convert a Node.js Readable to a string)
-
Node.js Readable을 Uint8Array로 변환 (Convert a Node.js Readable to an Uint8Array)
-
Node.js Readable을 ArrayBuffer로 변환 (Convert a Node.js Readable to an ArrayBuffer)
테스트 (Test)
-
bun test에서 메서드 스파이 (Spy on methods inbun test) -
Bun 테스트 러너 (test runner)로 조기 종료 (Bail early with the Bun test runner)
-
bun test에서 함수 모킹 (Mock functions inbun test) -
Bun의 watch 모드로 테스트 실행 (Run tests in watch mode with Bun)
-
bun test에서 스냅샷 테스트 사용 (Use snapshot testing inbun test) -
Bun 테스트 러너 (test runner)로 테스트 건너뛰기 (Skip tests with the Bun test runner)
-
Bun과 함께 Testing Library 사용하기 (Using Testing Library with Bun)
-
bun test에서 스냅샷 업데이트 (Update snapshots inbun test) -
Bun 테스트 러너로 테스트 실행 (Run your tests with the Bun test runner)
-
Bun의 테스트 러너에서 시스템 시간 설정 (Set the system time in Bun's test runner)
-
Bun의 테스트 러너에서 테스트별 타임아웃 설정 (Set a per-test timeout with the Bun test runner)
-
Jest에서 Bun의 테스트 러너로 마이그레이션 (Migrate from Jest to Bun's test runner)
-
Bun과 happy-dom을 사용하여 브라우저 DOM 테스트 작성 (Write browser DOM tests with Bun and happy-dom)
-
Bun의 테스트 러너로 테스트를 "todo"로 표시 (Mark a test as a "todo" with the Bun test runner)
-
Bun의 테스트 러너로 테스트를 여러 번 재실행 (Re-run tests multiple times with the Bun test runner)
-
Bun의 테스트 러너로 코드 커버리지 (code coverage) 보고서 생성 (Generate code coverage reports with the Bun test runner)
-
bun test로 Svelte 컴포넌트 import, require 및 테스트 (import, require, and test Svelte components with bun test)
-
Bun의 테스트 러너로 코드 커버리지 임계값 설정 (Set a code coverage threshold with the Bun test runner)
-
glob 패턴을 사용하여 선택적으로 테스트를 병렬 실행 (Selectively run tests concurrently with glob patterns)
-
Util의 메서드 스파이 (Spy on methods in Util)
-
UUID 생성 (Generate a UUID)
-
비밀번호 해싱 (Hash a password)
-
HTML 문자열 이스케이프 (Escape an HTML string)
-
현재 Bun 버전 가져오기 (Get the current Bun version)
-
Bun을 최신 버전으로 업그레이드 (Upgrade Bun to the latest version)
-
base64 문자열 인코딩 및 디코딩 (Encode and decode base64 strings)
-
gzip으로 데이터 압축 및 압축 해제 (Compress and decompress data with gzip)
-
정해진 밀리초 동안 대기 (Sleep for a fixed number of milliseconds)
-
Bun에서 코드가 실행될 때 감지 (Detect when code is executed with Bun)
-
두 객체가 깊은 동등성(deeply equal)을 갖는지 확인 (Check if two objects are deeply equal)
-
DEFLATE로 데이터 압축 및 압축 해제 (Compress and decompress data with DEFLATE)
-
현재 엔트리포인트(entrypoint)의 절대 경로 가져오기 (Get the absolute path to the current entrypoint)
-
현재 파일의 디렉토리 가져오기 (Get the directory of the current file)
-
현재 파일이 엔트리포인트인지 확인 (Check if the current file is the entrypoint)
-
현재 파일의 파일 이름 가져오기 (Get the file name of the current file)
-
파일 URL을 절대 경로로 변환 (Convert a file URL to an absolute path)
-
절대 경로를 파일 URL로 변환 (Convert an absolute path to a file URL)
-
현재 파일의 절대 경로 가져오기 (Get the absolute path of the current file)
-
실행 가능한 bin 파일로의 경로 가져오기 (Get the path to an executable bin file)
-
WebSocket
-
파일 쓰기 (Write file)
Bun에 기여를 시작하려면 Project > Contributing 가이드를 참조하세요.
Bun의 라이선스에 관한 정보는 Project > License 페이지를 참조하세요.
AI 자동 생성 콘텐츠
본 콘텐츠는 GitHub Trending All (daily)의 원문을 AI가 자동으로 요약·번역·분석한 것입니다. 원 저작권은 원저작자에게 있으며, 정확한 내용은 반드시 원문을 확인해 주세요.
원문 바로가기