JSPM

fetch-to-curl-ts

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 126
  • Score
    100M100P100Q75070F
  • License MIT

Convert fetch HTTP request to curl

Package Exports

  • fetch-to-curl-ts
  • fetch-to-curl-ts/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fetch-to-curl-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fetch-to-curl-ts

Convert fetch inputs to a cURL string.

Fork of leoek/fetch-to-curl with improved TypeScript support and improved payload serialization.

main

Installation

npm install fetch-to-curl-ts
yarn add fetch-to-curl-ts
pnpm install fetch-to-curl-ts

Usage

import { fetchToCurl } from 'fetch-to-curl';
const curlString = await fetchToCurl('https://jsonplaceholder.typicode.com/posts/1', {
  headers: {
    accept: 'application/json'
  }
});
// curlString ===
// curl "https://jsonplaceholder.typicode.com/posts/1" -X GET -H 'accept: application/json'

See ./src/test/main.test.ts for more examples.