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で見る