<commit_before>os = require 'os'
fs = require 'fs'
hat = require 'hat'
path = require 'path'
Busboy = require 'busboy'
parser = require 'csv-parse'
{ generateFakeClient } = require './../client'

module.exports.parserOpts = csvParseOpts =
  delimiter: ','
  columns: ['email', 'firstName', 'lastName', 'role']
  relax: no # Preserve quotes inside unquoted field.
  relax_column_count: yes
  skip_empty_lines: true
  trim: true # remove whitespaces
  auto_parse: no # convert integers to numbers etc

module.exports.handler = (req, rres) ->
  generateFakeClient req, rres, (err, client, session) ->
    return rres.status(500).send err  if err

    fileName = path.join(os.tmpDir(), "team-upload-#{session.groupName}-#{hat(32)}.csv")

    respond = (code, message) ->
      fs.unlink(fileName) # clean up after yourself
      return rres.status(code).send message<commit_msg>use parseOptions from invitetoteambycsv<commit_after>os = require 'os'
fs = require 'fs'
hat = require 'hat'
path = require 'path'
Busboy = require 'busboy'
parser = require 'csv-parse'
{ generateFakeClient } = require './../client'
{ parserOpts: csvParseOpts } = require './invitetoteambycsv'


module.exports.handler = (req, rres) ->
  generateFakeClient req, rres, (err, client, session) ->
    return rres.status(500).send err  if err

    fileName = path.join(os.tmpDir(), "team-upload-#{session.groupName}-#{hat(32)}.csv")

    respond = (code, message) ->
      fs.unlink(fileName) # clean up after yourself
      return rres.status(code).send message
{'fraction_non_alphanumeric': 0.141644908616188, 'fraction_numerical': 0.006527415143603133, 'mean_word_length': 4.076158940397351, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3225397', 'n_tokens_mistral': 502, 'n_tokens_neox': 499, 'n_words': 134}