<commit_before>
fs = require 'fs'
crypto = require 'crypto'
path = require 'path'

createHashID = ->
  crypto.createHash('sha1').update("#{Math.random()}").digest('hex');

module.exports = (file, callback) ->
  return callback("No `image` file. Make sure the `image` field is being set.") unless file

  p = path.normalize("#{global.image_path}#{createHashID()}_#{file.name}")
  fs.rename file.path, p, (error) ->
    return callback(error) if error
    callback null, path
<commit_msg>Change image copy method to work accross different partitions<commit_after>
fs = require 'fs'
crypto = require 'crypto'
path = require 'path'

createHashID = ->
  crypto.createHash('sha1').update("#{Math.random()}").digest('hex');

module.exports = (file, callback) ->
  return callback("No `image` file. Make sure the `image` field is being set.") unless file

  _path = path.normalize("#{global.image_path}#{createHashID()}_#{file.name}")
  is = fs.createReadStream file.path
  os = fs.createWriteStream _path

  is.pipe os
  is.on 'end', ->
    fs.unlinkSync file.path
    callback null, _path
{'fraction_non_alphanumeric': 0.1589648798521257, 'fraction_numerical': 0.0018484288354898336, 'mean_word_length': 4.525510204081633, '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': '6414532', 'n_tokens_mistral': 345, 'n_tokens_neox': 347, 'n_words': 96}