         res.setHeader('Content-Type', 'text/json')
         res.send(results)
         res.end()
-        
+
   else
     Grid.gfs.collection('media').findOne query, (err, filedata) =>
       return errors.notFound(res) if not filedata


saveURL = (req, res) ->
  options = createPostOptions(req)
  checkExistence options, res, req.body.force, (err) ->
    return errors.serverError(res) if err
    writestream = Grid.gfs.createWriteStream(options)
    request(req.body.url).pipe(writestream)


saveFile = (req, res) ->
  options = createPostOptions(req)
  force = req.user.isAdmin() and req.body.force
  checkExistence options, res, force, (err) ->
    return if err
    writestream = Grid.gfs.createWriteStream(options)
    f = req.files[req.body.postName]
