formatflex
v1.0.5
Published
FormatFlex is a file converter toolkit. It allows you to convert to many different file types.
Downloads
6
Maintainers
Readme
FormatFlex
FormatFlex is a file converter toolkit. It allows you to convert to many different file types.
Installation
npm install formatflex
Usage
Initialize
const formatflex = require("formatflex");
const formater = formatflex.initFormater();
Supported operations
const { zipFolder } = formater.utils;
const { jsonToSQL, jsonToCSV, jsonToXML, jsonToYAML } = formater.json;
const { csvToJSON, csvToXML } = formater.csv;
JSON formater
const inputPath = "./myJSONfile.json";
const outputPath = "./output.csv";
formater.json.jsonToCSV(inputPath, outputPath);
formater.json.jsonToYAML(inputPath, outputPath);
formater.json.jsonToSQL(inputPath, outputPath);
formater.json.jsonToXML(inputPath, outputPath);
CSV formater
const inputCSV = "./myCSVfile.csv";
const outputPath = "./output.json";
formater.csv.csvToJSON(inputCSV, outputPath);
formater.csv.csvToXML(inputPath, outputPath);
Zip a folder
const folderPathToZip = "./src";
const outputPath = "./myZip.zip";
zipFolder(folderPathToZip, outputPath);