I’m trying to use Tizen download API to download media from a server (images, videos, gifs, etc), and it doesn’t download the file properly. This is the file output.
and when I try to console.log the download request and the mime type, this is what I get
Also, there is no issue with the download. It keeps saying download complete, and it stores the file in the exact location, but the file is not an image (for this example, I tried to download an image)
This is my code which I get from the tizen download API documentation
const downloadUrl = 'https://magic-sign.cloud/v4/web/MSlibrary/wi-night-partly-cloudy.jpg';
const downloadFileName = 'wi-night-partly-cloudy.jpg';
var downloadRequest = new tizen.DownloadRequest(downloadUrl, path, downloadFileName);
tizen.systeminfo.getPropertyValue('NETWORK', function(networkInfo) {
if (networkInfo.networkType === 'NONE') {
console.log(`Network connection is not available.
Download is not possible.`);
downloadRequest = null;
}
});
var listener = {
/* When the download progresses (interval is platform-dependent) */
onprogress: function(id, receivedSize, totalSize) {
console.log('Received with id: ' + id + ', ' + receivedSize + '/' + totalSize);
},
/* When the user pauses the download */
onpaused: function(id) {
console.log('Paused with id: ' + id);
},
/* When the user cancels the download */
oncanceled: function(id) {
console.log('Canceled with id: ' + id);
},
/* When the download is completed */
oncompleted: function(id, fullPath) {
console.log('Completed with id: ' + id + ', full path: ' + fullPath);
},
/* When the download fails */
onfailed: function(id, error) {
console.log('Failed with id: ' + id + ', error name: ' + error.name);
}
};
let downloadId = tizen.download.start(downloadRequest, listener);
tizen.download.getState(downloadId);
var state = tizen.download.getState(downloadId);
console.log(state);
var downloadRequest = tizen.download.getDownloadRequest(downloadId);
console.log(downloadRequest);
var MIMEType = tizen.download.getMIMEType(downloadId);
console.log(MIMEType);
Can anyone help me please