Downloading Files from Server and Saving to Local Storage

1,261 views
Skip to first unread message

Alex Moore

unread,
Nov 17, 2011, 4:49:21 AM11/17/11
to Chromium HTML5, al...@prohost.com.au
Hi guys,

On our server we have 500 or so audio files per user in mp3 format.
We want to create an application that can work offline so that when
the user disconnects from the internet, they still have access to all
of these audio files.

Our original idea was to have the client read the files from the
server and save them to the local storage. So far we have been able
to use a form field to save the file to the local storage and play it
back using the file api, but we can't work out how to get the client
side application to syncronise the files from the server side.

We've had a look at
var bb = new BlobBuilder();
bb.append("Lorem ipsum");
var fileSaver = window.saveAs(bb.getBlob(), "test_file");
fileSaver.onwriteend = myOnWriteEnd;

but this doesn't seem to be supported in chromimum. I'm guessing the
way it would work is we would make a number of xhr requests to
download the files and then use some function to save that blob to
disk. (although it would be better if we could just stream files to
disk if that would save on memory).

We've been working on this for a couple of days now, so any help would
be greatly appreciated.

Thanks

Eric Bidelman

unread,
Nov 17, 2011, 9:12:24 AM11/17/11
to Alex Moore, Chromium HTML5, al...@prohost.com.au
FileSaver is not implemented in any browser, but the HTML5 filesystem supports your use case well: http://www.html5rocks.com/en/tutorials/file/filesystem/

You could even combine using a worker to download the files via xhr2 since you have lots:



--
You received this message because you are subscribed to the Google Groups "Chromium HTML5" group.
To post to this group, send email to chromiu...@chromium.org.
To unsubscribe from this group, send email to chromium-html...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-html5/?hl=en.




--
Eric Bidelman | Senior Developer Programs Engineer | e.bid...@google.com 
Reply all
Reply to author
Forward
0 new messages