try below code:
download(){
const fileTransfer: FileTransferObject = this.transfer.create();
const url = "http://codersthought.com/sourav/videostatus/wp-content/uploads/2014/12/SampleVideo_1280x720_1mb.mp4";
var URL = encodeURI(url);
fileTransfer.download(URL, this.file.dataDirectory + 'SampleVideo_1280x720_1mb.mp4',true).then((entry) => {
console.log('download complete: ' + entry.toURL());
}, (error) => {
// handle error
});
}
otherwize create folder:
install ionic native File plugin
this.file.createDir(targetPath,'video',true)
.then((res) => console.log('createDir video res',res))
.catch((err) => console.log('createDir video err',err));
const fileTransfer: FileTransferObject = this.transfer.create();
const url = "http://codersthought.com/sourav/videostatus/wp-content/uploads/2014/12/SampleVideo_1280x720_1mb.mp4";
var URL = encodeURI(url);
fileTransfer.download(URL, this.file.dataDirectory +'video/'+ 'SampleVideo_1280x720_1mb.mp4',true).then((entry) => {
console.log('download complete: ' + entry.toURL());
}, (error) => {
// handle error
});
Hope this will resolve your issue
thanks