Ted
Ted

Reputation: 47

Storing the pages of a book within Ionic App

I’m building an app which includes the ability for users to read through a single book in an e-reader format. My question is, where do I store all of the text data which makes up the book?

I’ve tried a couple of things: Storing the pages as .json files in the assets folder. I stopped trying with this method as I’ve read that the path to the assets folder changes depending on which device the app is loaded on. My app will be multiplatform so this put me off. Also, making http requests to within my own app seems a little ridiculous.

Importing json files as an import. This doesn’t suit me as the file loaded should change when the user wants to read the next page of the book.

Using Ionic Storage. This solution would be fine if I could find a way for the app to load with all of the book’s data in the ionic storage sqlite database. But I can only write one key and value at a time, and when the app loads for the first time, there’ll be a nasty script where the book’s content gets written into the sqlite database from my ionic_storage_service.ts.

What am I missing here? Any ideas are greatly appreciated! Thanks!

Upvotes: 0

Views: 153

Answers (1)

mahen23
mahen23

Reputation: 737

Depends on how many books. If you have less than 10 books, the IndexDB is a perfect fit for your requirements.

If more, i would suggest you to ask your app to connect to a remote server and download the books. Then save them in application storage

Upvotes: 0

Related Questions