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 για κεφαλίδες, -d και οι παραλλαγές της για το σώμα, -u για basic auth, μαζί με -A και -b. Μια σημαία δεδομένων υπονοεί POST.

Αποστέλλεται η εντολή μου σε διακομιστή;

Όχι. Η μετατροπή εκτελείται εξ ολοκλήρου στο πρόγραμμα περιήγησής σας, οπότε η εντολή σας και τυχόν tokens μέσα της δεν φεύγουν ποτέ από τη συσκευή σας.

Χειρίζεται εντολές πολλών γραμμών;

Ναι. Οι συνέχειες γραμμών με ανάστροφη κάθετο ενώνονται αυτόματα, οπότε μπορείτε να επικολλήσετε μια εντολή ακριβώς όπως εμφανίζεται στην τεκμηρίωση.

Πηγές

Ενσωματώστε αυτό το εργαλείο

Προσθέστε αυτό το εργαλείο στον δικό σας ιστότοπο. Αντιγράψτε το παρακάτω απόσπασμα, ενημερώνεται αυτόματα.

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

Σχετικά εργαλεία