แปลงคำสั่ง curl เป็นโค้ด JavaScript fetch ที่เทียบเท่า ทั้งหมดในเบราว์เซอร์ของคุณ
วิธีใช้ cURL เป็น fetch
วางคำสั่ง curl
โค้ด fetch ที่เทียบเท่าถูกสร้างทันที
คัดลอก JavaScript ลงในโปรเจกต์ของคุณ
A converter that turns a curl command into equivalent JavaScript fetch code, parsing the method, URL, headers and body so you get a ready-to-use request instead of translating it by hand.
It is a common need: API docs and tools like browser devtools give you a curl command, but your app is written in JavaScript. This bridges the two so you can paste curl and get fetch.
It runs locally in your browser, so your command, including any tokens or credentials in the headers, never leaves your device.
It understands the common flags: -X for the method, -H for headers, -d and its variants for the body, -u for basic auth, plus -A for the user agent and -b for cookies. A data flag implies POST, matching how curl behaves.
Multi-line commands work as-is. Backslash line continuations are joined automatically, so you can paste a command exactly as it appears in documentation without cleaning it up first.
The output is a fetch call with the method, headers and body filled in, which you can drop into your code and await like any other fetch.
คำถามที่พบบ่อย
flags ทั่วไป: -X สำหรับ method, -H สำหรับ headers, -d และ variants สำหรับ body, -u สำหรับ basic auth บวก -A และ -b data flag หมาย POST
ไม่ การแปลงทำงานทั้งหมดในเบราว์เซอร์ของคุณ ดังนั้นคำสั่งและ tokens ใดๆ ในนั้นจะไม่ออกจากอุปกรณ์
ใช่ การต่อบรรทัดด้วย backslash ถูกรวมโดยอัตโนมัติ ดังนั้นคุณสามารถวางคำสั่งตามที่ปรากฏในเอกสาร
ฝังเครื่องมือนี้
เพิ่มเครื่องมือนี้ลงในเว็บไซต์ของคุณเอง คัดลอกสคริปต์ด้านล่าง โดยจะอัปเดตให้เป็นปัจจุบันโดยอัตโนมัติ
<iframe src="https://monu.tools/embed/th/curl-to-fetch" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>เครื่องมือที่เกี่ยวข้อง
แปลง JSON เป็น TOML และ TOML กลับเป็น JSON ในทั้งสองทิศทาง ทั้งหมดในเบราว์เซอร์ของคุณ
แปลงรูปภาพเป็น Base64 data URI สำหรับฝังใน HTML, CSS หรือ JSON ทั้งหมดในเบราว์เซอร์ของคุณ
สร้างสเกล tint และ shade พร้อมสี complementary, analogous และ triadic จากสีพื้นฐาน
แปลงรูปภาพใด ๆ ให้เป็นชุด favicon ครบชุด ได้แก่ .ico, ขนาด PNG, Apple touch icon และ web manifest โดยสร้างในเบราว์เซอร์ของคุณ