Monu Tools

ממיר cURL ל-fetch

המירו פקודת curl לקוד JavaScript fetch מקביל, הכול בתוך הדפדפן שלכם.

כיצד להשתמש בcURL ל-fetch

  1. 01

    הדביקו פקודת curl.

  2. 02

    קוד ה-fetch המקביל נוצר באופן מיידי.

  3. 03

    העתיקו את ה-JavaScript לפרויקט שלכם.

Turn curl into fetch

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.

Flags it understands

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

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.

Ready-to-run output

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.

שאלות נפוצות

אילו דגלי curl נתמכים?

הנפוצים: ‎-X עבור המתודה, ‎-H עבור headers, ‎-d והגרסאות שלו עבור הגוף (body), ‎-u עבור אימות בסיסי, וכן ‎-A ו-‎-b. דגל נתונים מרמז על POST.

האם הפקודה שלי נשלחת לשרת?

לא. ההמרה מתבצעת כולה בתוך הדפדפן שלכם, כך שהפקודה שלכם וכל הטוקנים שבה לעולם לא עוזבים את המכשיר.

האם הוא מטפל בפקודות מרובות שורות?

כן. המשכי שורה בלוכסן הפוך (backslash) מחוברים אוטומטית, כך שתוכלו להדביק פקודה בדיוק כפי שהיא מופיעה בתיעוד.

מקורות

הטמע את הכלי הזה

הוסף את הכלי הזה לאתר שלך. העתק את קטע הקוד שלהלן; הוא מתעדכן אוטומטית.

<iframe src="https://monu.tools/embed/he/curl-to-fetch" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

כלים קשורים