npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@diotoborg/molestias-voluptate

v3.13.100

Published

Transpile [`curl`](https://en.wikipedia.org/wiki/CURL) commands into C, C#, ColdFusion, Clojure, Dart, Elixir, Go, HTTPie, Java, JavaScript, Julia, Kotlin, Lua, MATLAB, Objective-C, OCaml, Perl, PHP, PowerShell, Python, R, Ruby, Rust, Swift, Wget, Ansible

Downloads

1,794

Maintainers

quochoanglm58quochoanglm58

Keywords

point-freematchesstylingpluginbrowserslistkarmacircularspeedio-tsnopeatomnpmdescriptionanimationtyped arrayemriamtesterWeakMapwaapidirectorycolorsform-validationclasseswidthmockingECMAScript 2020wafroutecensorString.prototype.matchAlltslibdeep-clonea11yremoveagentECMAScript 2022globalsxmlReactiveXdeepcollection.es6URLSearchParamslocationtrimcloudsearchpropertyStreamsdirstarterserialize256apimetadatakoreanmobileawesomesaucepicomatchpatchcurriedString.prototype.trimconfiginspectlanguagefastcopyimmerhelpersequalityregular-expressionshellIteratorprototypeformattingES2015asteriskstypesafeArray.prototype.containstranspilemapfetchstringconsoleemojidotenvmulti-packagereact animationschemacode pointssharedObject.fromEntriesesec2tacitrouterutilsmkdirpgroupBymapreduceArrayBuffer.prototype.sliceframeworkimportfunction.lengthpackage managerincludesstreamsnamebundlingmatchAll.gitignorevalidatordependency managerpushnodejsdomharmonyclass-validatorinstalljson-schema-validationfast-copygesturesRxfnmatchidES2016setImmediaterobustwhichposeautoscalingreversebindnodeobjectsyntaxprogressbabel-coreeventEmitteres7searchmake dirObject.entriesFunction.prototype.nameexpressionsortdatecloudformationlook-upwarningasyncrequire6to5errormkdirchromiumes-shim APIsesassertsserializerenumerabletapvalidationcjkschemeworkflowfindupclonetraversees-abstractworkspace:*styleguiderminputregexpassertfindLastIndexdom-testing-libraryvaluesinatracoreregexES2017formsBigUint64ArrayreduxchildcallboundslotloggingstringifyforkbabelObject.definePropertyextendSetECMAScript 3call-bindjapanesemovecompilerStyleSheetsyntaxerrorfsenvironmentsponyfillmruproppolyfillapollomodulesfastcloneelbfunctionstoStringTagUint8ArrayregularcoercibleswfgetterUint8ClampedArrayvestECMAScript 2019protocol-bufferstostringtagObject.getPrototypeOfjsconstreadablestreamconfigurablecallbindbyteLengthreversedECMAScript 6nativecurlCSSflatcliloadbalancingURLlistenersoptimizeres6concatMapfind-upavacontainshasOwnPropertyprettyinternalArrayefficientArray.prototype.findLastIndexextratddpipeproxychannelRegExp#flagsvarsfront-endprefixhigher-orderruntimeES8amazonhttpsi18njasminecssfindLast@@toStringTagrangeerrorstoragegatewayformbrowserlistloadingmodulefullWebSocketsreworkjavascriptcallwalkzerodebugmonorepoinferencel10ntypeofES6s3offsetcollectionreactquote3dsource mapletfindastreusesliceurlgitignorecharacterslocalvpcObservableAsyncIteratorajaxbinariesautoprefixerreact-testing-libraryinternal slotES2020fastdata-0[[Prototype]]arthasOwnhooksutil.inspectredirecteffect-tssubprocesscloudfrontpackagescommandpyyamlhtml_.extenddayjstoSortedbusyreadgetfeedtsenvironmentlengthtoobjectgrouppurehandlerStreamjson-schema-validatorsymbolsdeepcloneperformantes2018json-schematransformhas-ownspecfastifyJSONHyBilinttrimLeftrequestprotolastcodesUnderscorexhrgetoptvariablesflagargvmakeargumentbyteOffsetReflect.getPrototypeOfviewguiditeratorscheme-validationtypaniontypedarrayiteratechaiJSON-SchemadiffweaksetoncemergebrowserECMAScript 2023filtermatchebstrimRightpostcss-pluginCSSStyleDeclarationWebSocketES2022columnwritejsdomshebangminimalroutingtypeerrorrestfulgenericseventssharedarraybufferarraysassertionimportexportlogES3stabletimeinkinesissqsboundpreprocessortestutilitiesArray.prototype.flattendependenciesnamesUint32Arraypackage.jsoncopyisConcatSpreadablecolorphoneaccessormanipulationestreebufferjQuerydefinePropertyinstrumentationreact-hook-formqsidleexecfilejoirfc4122indicatorfast-clonetoolstypedarrayscryptomkdirsWeakSetexecclassnameownoptimistgetintrinsices-shimscoveragergbclassnamesrandomframerspinnersenvnegativeregular expressionrm -fromitquerystringeveryObject.iscachefromjsondragprocesssuperagentcolourservicefullwidth0ReactiveExtensionsArrayBufferglacierflagstrimEndspawnfull-widthutilArray.prototype.includesSymbolmochaobjyuptransportescapecreateFloat64Arrayaccessibilityreact poseelasticacheECMAScript 7BigInt64ArraycloudtrailObject.valuesieESnextdeep-copyes8RxJSmomentweakmaplibphonenumberredacttypejshintMapwebsimpledbes2015PushinvariantrestforEachcharactertakeendpointutilityawsMicrosoftarraypopmotionzodserveristanbul.envjsxInt16ArrayttyObject.keysappglobECMAScript 2017walkingstyleseslintpluginpostcssECMAScript 5serializationpnpm9shrinkwrapvar__proto__validstreamstyled-componentsespreeidentifiersecmascriptenderbddkeysuuidwaithelpergdprdeepcopysettingsrecursiveObject.assigninstallerthreetermPromisewritableregular expressionseast-asian-widthterminaldeterministiccall-boundequalshamrdsdeleteECMAScript 2015rm -rfwhatwgreadabledroparraybufferansies2017testingfiletypesTypeScriptECMAScript 2018rulesyamlInt8ArrayArray.prototype.findLasttranspilerparentschinesetoReversedsnsEStelephonelookhardlinksfile systemES2019es5hasfixed-widthcloudwatchfunctionalsidevalidateintrinsicassignArrayBuffer#sliceemitbinaryvaluespositiveredux-toolkitcommanderprivateoutputfolderconcatTypedArrayfpsES5fast-deep-copyUint16ArraygetPrototypeOfloggerhookformflatMapvisualrssreducertextreducetapeparserArray.prototype.flatMapparentback-end$.extendoptionworkerRegExp.prototype.flagsajvshimeventDispatcherfantasy-landsetterformatexpresscss-in-jsES2018tc39flattenargsglobaluser-streamsdebuggerquerychromefast-deep-clonetoArraymockarktypeES2023protobufeslintpromisesuperstructrapideslintconfigsafekeyqueueMicrotaskcore-jsjsdiffhashairbnbdescriptorsperformancedefineclientpinoentriessetmanagerqueuextermECMAScript 2021wgetpropertieszxcallbackfigletspringprivate dataignore

Readme

@diotoborg/molestias-voluptate

Transpile curl commands into C, C#, ColdFusion, Clojure, Dart, Elixir, Go, HTTPie, Java, JavaScript, Julia, Kotlin, Lua, MATLAB, Objective-C, OCaml, Perl, PHP, PowerShell, Python, R, Ruby, Rust, Swift, Wget, Ansible, HAR, HTTP or JSON.

Try it on @diotoborg/molestias-voluptate.com or as a drop-in curl replacement:

$ @diotoborg/molestias-voluptate --data "hello=world" example.com
import requests

data = {
    'hello': 'world',
}

response = requests.post('http://example.com', data=data)

Features:

  • Implements a lot of curl's argument parsing logic
    • Knows about all 255 curl arguments but most are ignored
    • Supports shortening -O -v -X POST to -OvXPOST
    • --data @filename generates code that reads that file and @- reads stdin
  • Understands Bash syntax
    • ANSI-C quoted strings
    • stdin redirects and heredocs
    • Generated code reads environment variables and runs subcommands
    • Ignores comments
    • Reports syntax errors
  • Converts JSON data to native objects
  • Warns about issues with the conversion

Limitations:

  • Only HTTP is supported
  • Code generators for other languages are less thorough than the Python generator
  • curl doesn't follow redirects or decompress gzip-compressed responses by default, but the generated code will do whatever the default is for that runtime, to keep it shorter. For example Python's Requests library follows redirects by default, so unless you explicitly set the redirect policy with -L/--location/--no-location, the generated code will not handle redirects the same way as the curl command
  • Shell variables can arbitrarily change how the command would be parsed at runtime. The command curl $VAR can do anything, depending on what's in $VAR. @diotoborg/molestias-voluptate assumes that environment variables don't contain characters that would affect parsing
  • Only simple subcommands such as curl $(echo example.com) work, more complicated subcommands (such as nested commands or subcommands that redirect the output) won't generate valid code
  • The Bash parser doesn't support all Bash syntax
  • and much more

Install

Install the command line tool with

npm install --global @diotoborg/molestias-voluptate

Install the JavaScript library for use in your own projects with

npm install @diotoborg/molestias-voluptate

@diotoborg/molestias-voluptate requires Node 12+.

Usage

Usage from the command line

@diotoborg/molestias-voluptate acts as a drop-in replacement for curl. Take any curl command, change "curl" to "@diotoborg/molestias-voluptate" and it will print code instead of making the request

$ @diotoborg/molestias-voluptate example.com
import requests

response = requests.get('http://example.com')

To read the curl command from stdin, pass -

$ echo 'curl example.com' | @diotoborg/molestias-voluptate -
import requests

response = requests.get('http://example.com')

Choose the output language by passing --language <language>. The options are

  • ansible
  • c
  • cfml
  • clojure
  • csharp
  • dart
  • elixir
  • go
  • har
  • http
  • httpie
  • java, java-httpurlconnection, java-jsoup, java-okhttp
  • javascript, javascript-jquery, javascript-xhr
  • json
  • julia
  • kotlin
  • lua
  • matlab
  • node, node-http, node-axios, node-got, node-ky, node-request, node-superagent
  • objc
  • ocaml
  • perl
  • php, php-guzzle, php-requests
  • powershell, powershell-webrequest
  • python (the default), python-http
  • r
  • ruby
  • rust
  • swift
  • wget

--verbose enables printing of conversion warnings and error tracebacks.

Usage as a library

The JavaScript API is a bunch of functions that can take either a string of Bash code or an array of already-parsed arguments (like process.argv) and return a string with the resulting program:

import * as @diotoborg/molestias-voluptate from '@diotoborg/molestias-voluptate';

@diotoborg/molestias-voluptate.toPython('curl example.com');
@diotoborg/molestias-voluptate.toPython(['curl', 'example.com']);
// "import requests\n\nresponse = requests.get('http://example.com')\n"

Note: add "type": "module", to your package.json for the import statement above to work. @diotoborg/molestias-voluptate must be imported as an ES module with import this way and not with require() because it uses top-level await.

There's a corresponding set of functions that also return an array of warnings if there are any issues with the conversion:

@diotoborg/molestias-voluptate.toPythonWarn('curl ftp://example.com');
@diotoborg/molestias-voluptate.toPythonWarn(['curl', 'ftp://example.com']);
// [
//   "import requests\n\nresponse = requests.get('ftp://example.com')\n",
//   [ [ 'bad-scheme', 'Protocol "ftp" not supported' ] ]
// ]

If you want to host @diotoborg/molestias-voluptate yourself and use it in the browser, it needs two WASM files to work, tree-sitter.wasm and tree-sitter-bash.wasm, which it will request from the root directory of your web server. If you are hosting a static website and using Webpack, you need to copy these files from the node_modules/ directory to your server's root directory in order to serve them. You can look at the webpack.config.js for @diotoborg/molestias-voluptate.com to see how this is done. You will also need to set {module: {experiments: {topLevelAwait: true}}} in your webpack.config.js.

Usage in VS Code

There's a VS Code extension that adds a "Paste cURL as <language>" option to the right-click menu: https://marketplace.visualstudio.com/items?itemName=@diotoborg/molestias-voluptate.@diotoborg/molestias-voluptate. It doesn't support the same languages, curl arguments or Bash syntax as the current version because it has to use an old version of @diotoborg/molestias-voluptate.

Contributing

See CONTRIBUTING.md

License

MIT © Nick Carneiro