1

I am writing a program that scrapes assets from a site(images & text), which will require the user to input which URL they would like to gather assets from. I then collect them all and zip all of them into a single file. I would like to then serve this zipped file to the user however I feel like the time to gather and zip the file is causing me to lose my connection to the user(10-15 seconds). Is there any way I can keep the connection to the user alive if this is my issue?

//Jquery post:
$.post( "GatherContent", { structure: userSelection, url: userURL } );

//lots of golang code server side to find all assets and compile them

zippedFile := compressfiles(directory)

w.Header().Set("Content-Type", "applicaiton/zip")
w.Header().Set("Content-Disposition", "attachment; filename='"+zippedFile+"'")
fmt.Println(zippedFile, zipPath)
http.ServeFile(w, r, zippedFile)
anonrose
  • 1,271
  • 3
  • 12
  • 19

0 Answers0