How can I store images from url with ionic 2?

I was thinking about using the File plugin, but I do not find any examples of how to use it. For instance, if I have a code snippet like this:

File.createFile(path, fileName, replace).then(data=>{ },error=>{ });

How am I supposed to use the method. What is the path and the fileName?

I am also thinking about using the SQLite plugin to store the images as a BLOB or base64, but I do not know convert an imgUrl e.g. “http://placekitten.com.s3.amazonaws.com/homepage-samples/408/287.jpg” to save it in the database?

Does anyone have any tips or tricks about how I can achieve this?

I ended up creating a base64 image as described here:

Hi @johnedvard
do you have a working example of storing an image(blob) to sqlite ?
could you share your code?
thank you

1 Like