curl_transcode

0.1.3 • Public • Published

curl_transcode

Transcode cURL query to various programming languages. The source directory that contains source files .curl.sh. Transcoding put results into the target directory. The source file name is keep unchange, the extension is changed to specific programming language. There are programming supported languages and platforms:

  • cURL
  • Rust
  • Go
  • C#
  • Java
  • Node.js
  • Python

Quickstart

npm install curl_transcode
mkdir source target
echo '{"replace": ["API_ENDPOINT"]}' > .curl_transcode.json
echo 'API_ENDPOINT="https://foo.bar/baz"' > .env
echo 'curl -X GET "$API_ENDPOINT"' > source/get.curl.sh
npx curl_transcode source target

Command

curl_transcode <source_directory> <target_directory>
  • source_directory - Path to directory that contains source files .curl.sh. It must be existed.
  • target_directory - Path to directory to put result files. It must be existed.

Configuration

// File: ".curl_transcode.json".
// Support JSON5 format.

{
  // List of tokens to replace by environment variable from source files
  // `.curl.sh`.
  //
  // Default: []
  //
  // Example: `API_ENDPOINT` will replace token `$API_ENDPOINT` by value of
  // environment variable `API_ENDPOINT`.
  "replace": ["API_ENDPOINT"]
}
# File: ".env"
# Contains environment variables for replacing source files `.curl.sh`.
API_ENDPOINT="https://foo.bar/baz

/curl_transcode/

    Package Sidebar

    Install

    npm i curl_transcode

    Weekly Downloads

    0

    Version

    0.1.3

    License

    ISC

    Unpacked Size

    13.7 kB

    Total Files

    17

    Last publish

    Collaborators

    • kevin.leptons