<commit_before>exec  = (require 'child_process').exec

uploadFileAPI = (domain, localPath, simPath, token, callback)->
    file_url = "#{domain}/file/#{simPath}"
    exec """curl --silent -L -H "Authorization: Bearer #{token}" -F content=@#{localPath} -F method=PUT #{file_url}""", callback

uploadZip = (domain, localPath, simPath, token, callback)->
    file_url = "#{domain}/file/#{simPath}"
    exec """curl -L -H "Authorization: Bearer #{token}" -F content=@#{localPath} -F method=PUT #{file_url}""", ->
        zip_file_name = localPath.slice(localPath.lastIndexOf('/'))
        zip_file_url = "#{file_url}#{zip_file_name}"
        exec """curl -L -H "Authorization: Bearer #{token}" -F type=Application/unzip -F method=PATCH #{zip_file_url}""", callback

exports.uploadFileAPI = uploadFileAPI
exports.uploadZip = uploadZip<commit_msg>make file patch to unzip on epicenter work<commit_after>exec = (require 'child_process').exec
path = require 'path'

uploadFileAPI = (domain, localPath, simPath, token, callback) ->
    file_url = "https://#{domain}/file/#{simPath}"
    file_name = path.basename localPath
    exec """curl --silent -L -H "Authorization: Bearer #{token}" -F file=@#{localPath} -F name=#{file_name} -X PUT #{file_url}""", callback

uploadZip = (domain, localPath, simPath, token, callback) ->
    file_url = "https://#{domain}/file/#{simPath}"
    file_name = path.basename localPath
    unzip_params =
        contentType: "application/unzip"
    exec """curl -L -H "Authorization: Bearer #{token}" -F file=@#{localPath} -F name=#{file_name} -X PUT #{file_url}""", ->
        process.stdout.write " unzipping....."
        exec """curl -L -H "Authorization: Bearer #{token}" -H "Content-Type: application/json" -d '#{JSON.stringify unzip_params}' -X PATCH #{file_url}/#{file_name}""", callback

exports.uploadFileAPI = uploadFileAPI
exports.uploadZip = uploadZip
{'fraction_non_alphanumeric': 0.17550371155885472, 'fraction_numerical': 0.0, 'mean_word_length': 4.3456090651558075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '6063909', 'n_tokens_mistral': 621, 'n_tokens_neox': 622, 'n_words': 156}