<commit_before>var os = require('os')
var path = require('path')
var express=require("express")
var serveStatic = require('serve-static')
var multer  = require('multer')

DEFAULT_OPTS = {
  dest: path.join(os.tmpdir(), 'fshare'),
  limits: null
}

module.exports = function(opts){
  opts = opts || DEFAULT_OPTS

  var storage = multer.diskStorage({
    destination: opts.dest,
    filename: function (req, file, cb) {
      //TODO: will it clash on muptiple requests at once?
      cb(null, Date.now().toString(16)+path.extname(file.originalname))
    }
  })
  var upload = multer({ storage: storage, limits: opts.limits })

  var fshare = express.Router()

  fshare.use('/', serveStatic(opts.dest))

  fshare.post('/', upload.single('file'), function(req,res){
      res.set('Connection', 'close');
      res.end(req.file.filename)
  })

  return fshare;
}
<commit_msg>rename 'dest' option to 'destination'<commit_after>var os = require('os')
var path = require('path')
var express=require("express")
var serveStatic = require('serve-static')
var multer  = require('multer')

DEFAULT_OPTS = {
  destination: path.join(os.tmpdir(), 'fshare'),
  limits: null
}

module.exports = function(opts){
  opts = Object.assign({}, DEFAULT_OPTS, opts) 

  var storage = multer.diskStorage({
    destination: opts.destination,
    filename: function (req, file, cb) {
      //TODO: will it clash on muptiple requests at once?
      cb(null, Date.now().toString(16)+path.extname(file.originalname))
    }
  })
  var upload = multer({ storage: storage, limits: opts.limits })

  var fshare = express.Router()

  fshare.use('/', serveStatic(opts.destination))

  fshare.post('/', upload.single('file'), function(req,res){
      res.set('Connection', 'close');
      res.end(req.file.filename)
  })

  return fshare;
}

{'fraction_non_alphanumeric': 0.16361619523017193, 'fraction_numerical': 0.0022185246810870773, 'mean_word_length': 4.053221288515406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3029478', 'n_tokens_mistral': 594, 'n_tokens_neox': 579, 'n_words': 137}