10

Say I have a webapp which executes in its entirety on the client-side. Its purpose is to act as a file conversion utility, for example converting a user's local stored word document into a PDF.

So with the user's permission, the app can read a specified local file and process it, in memory, into PDF format.

How can I get the user to 'download' the result? since the data is held in the browser's memory anyway, I do not wish to upload it to some server.

[edit]

  • No flash based solutions
  • Expected file sizes to be up to 15mb
willcode.co
  • 674
  • 1
  • 7
  • 17
  • 2
    You could try giving them a link to the file, with the href pointing to a base-64 encoded data URI, perhaps? http://en.wikipedia.org/wiki/Data_URI_scheme – Michael Schuller Jan 23 '13 at 09:41
  • 1
    What's wrong about http://stackoverflow.com/questions/2897619/using-html5-javascript-to-generate-and-save-a-file?rq=1? Should cover your problem entirely. – aefxx Jan 23 '13 at 09:47
  • Was about to agree completely. But I do not want to use flash at all. And I fear that data URI would be too restrictive - can I encode a 50mb file in a data URI? – willcode.co Jan 23 '13 at 09:52

1 Answers1

11

The solution for my case will be to use the HTML5 FileSaver API.

Perhaps this question should just be closed as it is effectively a duplicate of

Using HTML5/Javascript to generate and save a file

Thanks to aefxx

Community
  • 1
  • 1
willcode.co
  • 674
  • 1
  • 7
  • 17