Creating and loading a text file in javascript

All my research so far has shown that this cannot be done, but I hope that someone has some clever ideas.

I have a form on a website that allows users to upload a large number of URLs to be added to the list on the server. Each URL has quite a bit of server-side processing, so to avoid timeouts and show progress, I implemented a download using jQuery to send the URLs one at a time using ajax.

It all works well. However, part of the processing for each URL deduplicates it throughout the list. An Ajax call returns a status indicating either a successful download or a denial of duplication. As the download progresses, I tell the user how many URLs were rejected as duplicates (along with the overall progress and ETA).

Now the problem is how to provide the user with a complete list of failed duplicate URLs. I saved them in an array in jQuery and would like the user to be able to click on the form link to download a text file containing these URLs. Is this only possible using client processing?

Server-side processing basically processes one keyword at a time. I would prefer not to store duplicates in the database table with some kind of session key, which is sent with every ajax call, and then used at the end to generate a text file on the server side (and then cleared some after a while). I see how to do it, but it seems very awkward and a bit of the 20th century.

+4
source share
1 answer

I have not used it myself yet, but Downloadify was built specifically for this purpose. I think so.

Downloadify is a small JavaScript + Flash library that allows you to generate and save files on the fly in a browser without interacting with the server.

It was created by Doug Neiner , who is also quite active in stack overflows.

Flash 10 required to work.

+3
source

Source: https://habr.com/ru/post/1309132/


All Articles