1.1.1 • Published 2 years ago

format-cnv v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

text-format-converter

js package for convert different format of text file

lets say you need yaml configuration and you already have json file with the same data, just use this package and convert the file to yaml.

installation

npm i format-cnv

or install globally for cli usage

npm i -g format-cnv

Code usage

const {convertCSVToObject} = require("format-cnv/lib");

const csvObj = convertCSVToObject(`fname,lname
ofir, elarat
fisrtname, lastname`);

console.log(csvObj)

Functions:

functiondescriptioninput
convertCSVToObjectconvert csv string format to objectstring
convertObjectToCSVconvert object to csv string foramtobject
convetXMLToObjectconvert xml string format to objectstring
convertObjectToXMLconvert object to xml string foramtobject
convetYAMLToObjectconvert yaml string format to objectstring
convertObjectToYAMLconvert object to yaml string foramtobject
convertJSONToObjectconvert json string format to objectstring
convertObjectToJSONconvert object to json string foramtobject
convertb64ToUTF8convert base64 string UTF8 objectstring
convertTextToBase64convert string to base64 stringstring

CLI usage

Usage: -i <input-file> -it <input-type> -o <output-file> -ot <output-type>
ALIASDESCRIPTIONTYPE
--helpShow helpboolean
--versionShow version numberboolean
-i, --inputFileinput file pathstring
--it, --inputTypeinput file type: JSON/YAML/XML..string
-o, --outputFileoutput file pathstring {console if null}
--ot, --outputTypeoutput file type: JSON/YAML/XML..string

The supported format for now are:

  • JSON
  • XML
  • YAML
  • CSV

Examples:

  • JSON To YAML

    format-cnv -i /sample.json --it JSON -o /output.yaml --ot YAML

  • JSON To XML

    format-cnv -i /sample.json --it JSON -o /output.xml --ot XML

  • YAML To JSON

    format-cnv -i /sample.yaml --it YAML -o /output.json --ot JSON

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago