2.0.1 • Published 5 years ago
types-from-csv v2.0.1
Types From CSV
Overview
types-from-csv is a package I wrote to help me infer SQL types given a CSV file. It's very rudimentary. It takes in the path to a CSV and returns a list of objects of the form:
[
{name: 'columnOneName', type: 'bit'},
{name: 'columnTwoName', type: 'date'},
{name: 'columnThreeName', type: 'char'},
{name: 'columnFourName', type: 'number'},
{name: 'columnFiveName', type: 'string'}
]
Currently, it only detects those types. 'string' is the fallback if nothing else matches.
Usage
const csvTypes = require('csv-types');
const typeData = csvTypes.getTypesFromCSV('yourpath.csv');
console.log(typeData);