1.2.0 • Published 5 months ago

@selei/converter v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Converter

Converter is a CLI and API for converting JSON, CSV, XML and YAML files.

Table of Contents

Introduction

Converter is a CLI and API that converts and transforms files into different types using a single function.

Features added in v1.2.0

  • JSON, CSV and XML converts to YAML
  • YAML converts to JSON, CSV or YAML
  • Added read() method

Installation

To install Converter:

npm i @selei/converter

API

async converter(filePath, convertTo, destPath)

  • filePath: The full path to the file to be converted
  • convertTo: We currently only supports "csv", "json", "xml" and "yaml"
  • destPath: The path where the transformed file will be located

Simple usage:

await converter("data.json", "csv", "data.csv");

Reading data after conversion:

const converted = await converter("data.json", "csv", "data.csv");
const convertedData = await converted.read();

CLI

To initialize the CLI use:

$ converter

You can also use the -F and -C flags:

$ converter -F data.json -C csv

  • --file, -F: The file to be converted
  • --convert, -C: The type chosen for conversion (csv, json or xml)

Creator

The developer of Converter is Victor Seleimend.

License

MIT

1.2.0

5 months ago

1.1.0

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago