I found this 
[code](https://github.com/dom96/jester/blob/master/tests/fileupload.nim) for 
uploading files, but it only works well for small files. With large files 
(100MB) it’s very slow and my cpu goes up to close to 100%!
    
    
    import os, re, jester, asyncdispatch, htmlgen, asyncnet
    
    routes:
      get "/":
        var html = ""
        for file in walkFiles("*.*"):
          html.add "<li>" & file & "</li>"
        html.add "<form action=\"upload\" 
method=\"post\"enctype=\"multipart/form-data\">"
        html.add "<input type=\"file\" name=\"file\"value=\"file\">"
        html.add "<input type=\"submit\" value=\"Submit\" name=\"submit\">"
        html.add "</form>"
        resp(html)
      
      post "/upload":
        writeFile("uploaded.png", request.formData.getOrDefault("file").body)
        resp(request.formData.getOrDefault("file").body)
    runForever()
    
    
    Run

Does anyone have any idea how I can do this task with the Jester?

Reply via email to