Closed
Bug 1066675
Opened 11 years ago
Closed 11 years ago
SystemXHR and DeviceStorage
Categories
(Firefox OS Graveyard :: General, defect)
Firefox OS Graveyard
General
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 855952
People
(Reporter: bonuspunkt+bugzilla, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0
Build ID: 20140830210550
Steps to reproduce:
im trying to download a podcast (140MB) to the device via wifi and store it in the music library
```
var musicStore = navigator.getDeviceStorage('music');
var xhr = new XMLHttpRequest({ mozSystem: true });
xhr.open('GET', 'http://localhost:8888/fs139-rectal-temperature-sensor-location.mp3');
xhr.send();
xhr.addEventListener('load', function() {
var blob = new Blob([xhr.responseText], { type: 'audio/mp3'});
console.log('loading done');
var add = musicStore.add(blob);
add.onsuccess = function() {
console.log('add success');
}
add.onerror = function() {
console.log('add error');
console.log(arguments);
}
});
```
Actual results:
in the simulator i get an error
Expected results:
i don't know if the api is good for that use case.
transforming the xhr.responseText to an Blob seems kinda big overhead.
maybe we there should be a download task for files that huge
or the xhr could stream into the music storage
Comment 1•11 years ago
|
||
You should set xhr.responseType = "blob" and then just get your blob from xhr.response. It still may be large though, so you may want to also look at chunking.
![]() |
Reporter | |
Updated•11 years ago
|
Component: Hardware → General
![]() |
Reporter | |
Comment 2•11 years ago
|
||
did i miss something or is it currently impossible to write chunked to DeviceStorage
![]() |
Reporter | |
Comment 3•11 years ago
|
||
oh, it's possible with
https://developer.mozilla.org/en-US/docs/Web/API/DeviceStorage.getEditable
and
https://developer.mozilla.org/en-US/docs/Web/API/FileHandle.open
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•