fetch-to-curl-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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.

Package Sidebar

Install

npm i fetch-to-curl-ts

Weekly Downloads

11

Version

1.0.2

License

MIT

Unpacked Size

15.5 kB

Total Files

11

Last publish

Collaborators

  • wa11-e