1.0.2 • Published 11 months ago

@kochtaik/csv-to-json-parser v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Csv to json parser

Short Description

You need to build a command line tool which allows the user to convert CSV files to JSON.

Topics

  • Core Concept
  • Event Loop
  • Globals
  • Modules
  • Streams
  • Async Operations
  • NPM
  • Network

Requirements

You need to build an npm package for parsing CSV files to JSON by implementing a custom NODE.js transform stream with the following abilities:

  1. Set or automatically detect the separator that is used for parsing (use "auto-detect" by default if no separator provided)
  2. Upload result JSON file to Google Drive disk
  3. Provide errors handling for converting process and incorrect command line arguments.

This application should accept following command line arguments using process.argv:

  1. "sourceFile" - path to the csv file that need to be converted.

  2. "resultFile" - path to the result json file.

  3. "separator" - separator that is used while converting.

An example of running the app with command line arguments:

- node csvToJson.js --sourceFile "source.csv" --resultFile "result.json" --separator ","
- node csvToJson.js --sourceFile "source.csv" --resultFile "result.json" --separator " "
- node csvToJson.js --sourceFile "source.csv" --resultFile "result.json"

If you want to upload file to the Google Drive, please, do the following steps:

  1. Get your credentials from the Google Cloud console. They must include client ID, client secret, redirect URL and refresh token. Create a .env file and save them under next variables (respectively): GOOGLE_DRIVE_CLIENT_ID, GOOGLE_DRIVE_CLIENT_SECRET, GOOGLE_DRIVE_REDIRECT_URI, GOOGLE_DRIVE_REFRESH_TOKEN.
  2. Run the script with the argument --uploadToGDrive. The file will appear in your Google Drive, under "JSON-to-CSV parser" folder.

Testing

Write a function that generates at least 10 gigabyte CSV file base on the filled in with mock csv file Generate a CSV file and use it as an source file for your tool. When running the parser pay attention to the RAM that is taken by the process.

Publishing

Add version, name, description, and author of the package in package.json. Publish the package you created to the npm registry.

Advanced Requirements

  1. Implement JSON to CSV parser.
1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago