CURL to JavaScript Conversion
Transform CURL commands into modern JavaScript fetch API code for browser and Node.js applications.
Example
CURL Command
curl -X GET https://api.example.com/data -H "Authorization: Bearer token"
JavaScript fetch Code
fetch("https://api.example.com/data", {
method: "GET",
headers: {
"Authorization": "Bearer token"
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));