<commit_before>fs          = require "fs-extra"
path        = require "path"
sanitize 	= require "sanitize-filename"
uuid        = require "node-uuid"

module.exports = (files, cb) ->
	basePath = path.dirname(require.main.filename)
	volume = path.join basePath, 'uploads', uuid.v4()
	fs.ensureDirSync(volume)

	for file in files
		filename = sanitize file.name
		fs.writeFileSync path.join(volume, filename), file.code

	cb(null, volume)<commit_msg>Remove blocking on synchronous volume creationg<commit_after>fs          = require "fs-extra"
path        = require "path"
sanitize 	= require "sanitize-filename"
uuid        = require "node-uuid"

module.exports = (files, cb) ->
	basePath = path.dirname(require.main.filename)
	volume = path.join basePath, 'uploads', uuid.v4()
	fs.ensureDir volume, (err) ->
		unwrittenFileCount = files.length
		for file in files
			filename = sanitize file.name
			fs.writeFile path.join(volume, filename), file.code, (err) ->
				unwrittenFileCount--
				cb(null, volume) if unwrittenFileCount == 0
{'fraction_non_alphanumeric': 0.11980676328502415, 'fraction_numerical': 0.002898550724637681, 'mean_word_length': 3.625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5204832', 'n_tokens_mistral': 345, 'n_tokens_neox': 329, 'n_words': 85}