cURL converter · Node.js

cURL to Node.js

Paste a curl command and get server-side JavaScript. Node 18+ ships with global fetch; axios and ky are ready if you prefer.

InputcURL command
1 secret
MethodPOST·Headers2·Body46 B· Chars 187
OutputJavaScript · Node fetch(Node 18+)
// Node 18+ has global fetch
const response = await fetch("https://api.example.com/v1/messages", {
  method: "POST",
  headers: {
    "Authorization": "Bearer sk_test_123",
    "Content-Type": "application/json"
  },
  body: "{\"to\":\"+15551234567\",\"body\":\"Hello from curl\"}",
  redirect: "manual"
});
const data = await response.json();
Inspect

Top guides for Node.js

All guides →

Common questions

Do I need node-fetch?
No. Node 18+ has fetch built-in. Only add node-fetch if you're stuck on older versions.
How do I stream a response?
response.body is a WHATWG ReadableStream. Iterate with for await (const chunk of response.body) once you've swapped .json() for a stream reader.
Basic auth handling?
-u user:pass compiles into a Basic Authorization header using base64.
Is my curl sent anywhere?
No. Parsing happens entirely in your browser.

Also convert cURL to

All guides →

Same parser, same idiomatic output — swap the target language whenever your stack changes. Every hub carries its own reference guides for methods, payloads, and auth.