How to save image or file from other server in ionic app?

Hi friends i want to save file or image from another server in ionic app? Actually my requerment is when internate is not working then app should work offline also.User can downlod data but a button and all data saved in app storage.?Any idea

from what I understand you want to download files so the user can browse them offline ,
check this question :

and check this plugin :

When i use this code this error come in console log :

ReferenceError: cordova is not defined

are you trying this code on the browser or real device ?

i am using in browser

try using real device , and it should work
working with native features like http … etc requires real device or simulator/emulator or some special settings

i want this should save in app storage like in www folder image folder so i can access this is my code

try it on a real device and see if it works if so search for the folder and you can access it later

ok sir thanks i will check it

Now file donwload successfully.But problem is its downlod in documentsDirectory and how i can access this file in app from documentsDirectory ??