There is any way to save image/pdf content into local file system applicable for all browsers
<p>I got image content by ajax response in an array buffer.appended that array buffer to blob builder.now i want to write these contents to a file.Is there any way to do this..?
I used windows.requestFileSystem it is working fine with chrome but in mozilla not working..
here is my piece of code  ,</p>

<p>function retrieveImage(studyUID, seriesUID, instanceUID, sopClassUID,nodeRef) {</p>

<pre><code>     window.requestFileSystem = window.requestFileSystem||window.webkitRequestFileSystem;
var xhr = new XMLHttpRequest();
var url="/alfresco/createthumbnail?ticket="+ticket+"&amp;node="+nodeRef;
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';

xhr.onload = function(e) {
    if(this.status == 200) {
        window.requestFileSystem(window.TEMPORARY, 1024*1024, function(fs) {
            var fn = '';
            if(sopClassUID == '1.2.840.10008.5.1.4.1.1.104.1') {
                fn = instanceUID+'.pdf';
            } else {
                fn = instanceUID+'.jpg';
            }

                    fs.root.getFile(fn, {create:true}, function(fileEntry) {
                     fileEntry.createWriter(function(writer) {
                     writer.onwriteend = function(e) {
                        console.log(fileEntry.fullPath + " created");

                    }
                    writer.onerror = function(e) {
                        console.log(e.toString());
                    }

                    var bb;
                    if(window.BlobBuilder) {
                        bb = new BlobBuilder();
                    } else if(window.WebKitBlobBuilder) {
                        bb = new WebKitBlobBuilder();
                    }
                    bb.append(xhr.response);

                    if(sopClassUID == '1.2.840.10008.5.1.4.1.1.104.1') {
                        writer.write(bb.getBlob('application/pdf'));
                    } else {
                        writer.write(bb.getBlob('image/jpeg'));
                    }
                }, fileErrorHandler);
            }, fileErrorHandler);
        }, fileErrorHandler);
    }
};
xhr.send();
</code></pre>

<p>}</p>
