1

is there any option available in angular that allows to store images or pdf in angular local environment.

as i tried to implement but i haven't got success in that.

thanks in advance.

  • does this solve your question?https://stackoverflow.com/questions/10240110/how-do-you-cache-an-image-in-javascript – Alan Yu Nov 27 '21 at 05:08
  • no @AlexYu because after one or two day i have to access this same thing than that's not possible in that – Manthan Machhi Nov 27 '21 at 05:10
  • You can store files inside the `assets` folder. Please provide examples of how you try to do that. – Dmitry Grinko Nov 27 '21 at 05:31
  • @DmitryGrinko as i don't have any backup code but i tried this same but haven't able to store – Manthan Machhi Nov 27 '21 at 05:38
  • Does this answer the question ? https://stackoverflow.com/questions/19183180/how-to-save-an-image-to-localstorage-and-display-it-on-the-next-page – StefanP Nov 27 '21 at 10:46
  • 2
    Storing data in this size as base64 data url is too much big for a storage and for sure will lead with high performance issues in case if files that are stored became much... Best thing to do is to serve those files from a server u create or perhaps you could use firebase as it gives a good free storage space and if u got your own backend and serve files from it would be much better... and after that you would provide a caching service which could serve the files fast and act for future work as data is on device and not being served each time from server. – Mostafa Harb Nov 27 '21 at 11:11
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Dec 01 '21 at 18:16

1 Answers1

0

Hey you don't have write file access in browser for security reasons. but you can choose one of these approaches.

1- local storage gives you 5M space so you can convert your image to base64 string then store it their.

2- or you need to use cordova or capacitor plugin to do that if you work with ionic

amin arghavani
  • 1,883
  • 14
  • 21