Skip to main content

nextjs-api-file-upload

For Next.js App Router, use request.formData() and stream/parse the file (e.g. CSV) in the route handler. Do not use Express-style middleware (e.g. multer) in API routes—it can block the request pipeline and cause hangs. Use when implementing file upload in Next.js API routes.

소스 정보

저장소
pmarashian/cursor-agent-skills
최근 소스 활동
2026년 2월 13일 19:51
감지된 SKILL.md 언어
영어
스타
2
포크
1

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
nextjs-api-file-upload
description
For Next.js App Router, use request.formData() and stream/parse the file (e.g. CSV) in the route handler. Do not use Express-style middleware (e.g. multer) in API routes—it can block the request pipeline and cause hangs. Use when implementing file upload in Next.js API routes.
# Next.js API File Upload (App Router) This project uses **Next.js App Router**. File upload in API routes must use Next.js built-in handling, not Express middleware. ## Do Not Use - **Express middleware** (e.g. multer) in API routes. It can block the request pipeline and cause long hangs (e.g. login or upload appearing stuck). ## Do Use - **`request.formData()`** in the route handler. - **Stream or parse the file** (e.g. CSV) inside the handler after calling `formData()`. ## Example Pattern ```typescript // In app/api/upload/route.ts (or similar) export async function POST(request: Request) { const formData = await request.formData(); const file = formData.get('file') as File | null; if (!file) return Response.json({ error: 'No file' }, { status: 400 }); // Parse/stream file in handler (e.g. CSV parsing) // ... } ``` ## Integration - Can be merged into a broader "Next.js API" skill if one exists. Use for any task that adds or changes file upload in Next.js App Router API routes.
GitHub에서 보기