web-curl2har

0.0.1 • Public • Published

web-curl-to-har

This is a plugin used on the browser side to convert curl commands into har objects

usage

import webCurlToHar, { setConfig } from 'web-curl-to-har';

if (isElectron()) {
  if (process.env.NODE_ENV === 'development') {
    setConfig('./');
  } else {
    setConfig(window?.path.join(window.__dirname, './build/'));
  }
} else {
  setConfig('./');
}

const handleCurl2Har=()=>{
      const curl= `curl 'http://www.apipost.cn/' `
      const curlData = webCurlToHar(curl);
      console.log(curlData);
}


/*
logs:
[{"request":{"method":"GET","url":"http://www.apipost.cn/","httpVersion":"HTTP/1.1","cookies":[],"headers":[],"queryString":[],"headersSize":-1,"bodySize":-1}}]
*/

Readme

Keywords

none

Package Sidebar

Install

npm i web-curl2har

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

980 kB

Total Files

23

Last publish

Collaborators

  • proud_lion