Gathering detailed insights and metrics for fetch-to-curl
Gathering detailed insights and metrics for fetch-to-curl
Gathering detailed insights and metrics for fetch-to-curl
Gathering detailed insights and metrics for fetch-to-curl
convert-fetch-to-curl
Example to convert fetch to curl
r2curl
Node.js Request Wrapper (axios, fetch, ..) to cURL Command String
@sentry/cli
A command line utility to work with Sentry. https://docs.sentry.io/hosted/learn/cli/
node-fetch
A light-weight module that brings Fetch API to node.js
npm install fetch-to-curl
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
69 Stars
107 Commits
13 Forks
2 Watching
3 Branches
8 Contributors
Updated on 07 Nov 2024
JavaScript (84.45%)
HTML (15.55%)
Cumulative downloads
Total Downloads
Last day
11.1%
5,220
Compared to previous day
Last week
1.1%
22,832
Compared to previous week
Last month
-10.7%
100,686
Compared to previous month
Last year
22%
1,135,302
Compared to previous year
This module was inspired by http-to-curl. Use it to generate curl requests with the inputs you would usually use for javascripts fetch. However it does not patch any modules like http-to-curl. It is just a wrapper to generate the curl string. This ensures that there are no side effects with your actual usage of fetch.
Also note that the goal of this library is to be as simple and minimal as possible. This also means that there are zero dependencies :tada:
1yarn add fetch-to-curl
or
1npm install fetch-to-curl
1import { fetchToCurl } from 'fetch-to-curl'; 2// or In case there is no support for Es Modules in your environment: 3// const { fetchToCurl } = require("fetch-to-curl") 4 5const url = 'https://jsonplaceholder.typicode.com/posts/1'; 6const options = { 7 headers: { 8 Authorization: "BASIC SOMEBASE64STRING" 9 }, 10 method: 'get' 11}; 12// Log yopur request 13console.log(fetchToCurl(url, options)); 14// Do your request 15fetch(url, options); 16 17// Output 18curl "https://jsonplaceholder.typicode.com/posts/1" -X GET -H "Authorization: BASIC SOMEBASE64STRING" 19 20// You can also pass a single Request object 21console.log(fetchToCurl({ 22 url: "https://jsonplaceholder.typicode.com/posts/1" 23 headers: { 24 Authorization: "BASIC SOMEBASE64STRING" 25 }, 26 method: 'get' 27})); 28 29// and/or a Headers object as you would to with fetch 30console.log(fetchToCurl({ 31 url: "https://jsonplaceholder.typicode.com/posts/1" 32 headers: new Headers({ 33 Authorization: "BASIC SOMEBASE64STRING" 34 }), 35 method: 'get' 36})) 37
There is a minimal example of usage without package manager available which allows to directly test this in the browser console. (view source - playground.html)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 4/6 approved changesets -- score normalized to 6
Reason
5 existing vulnerabilities detected
Details
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More