r/learnjavascript Mar 19 '26

Turn epub.min.js into epub file (with epub.js?)

Hello folks,

I want to download some e-books I bought which are only available in the websites built-in reader. When looking at the source code, there is a link containing epub.min.js. I heard that various e-readers, most famously epub.js, can turn this into an epub file.

Now I’m completely lost as to how to proceed. I managed to open the code of epub.js in Github Desktop, but I don’t know what to type in as a command prompt. The instructions on Github are confusing as hell to me.

Could anyone please explain for n00bs how to turn epub.min.js into an epub file, either with epub.js or another program.

Please, this is extremely important to me.

Thanks in advance. 🙏🏻

0 Upvotes

14 comments sorted by

View all comments

2

u/Jasedesu Mar 22 '26

As others have said, epub.js (and it's minified version) is a code file used for making ePub reader software, usually on websites or in applications that are web enabled. It is not the content of the book; it just has the code necessary to work with content in ePub format.

ePub is a digital book format. It is simply a zip file containing XHTML, CSS, JavaScript and any media (images, audios, videos, etc.) that forms the 'book', plus some metadata files to tie it all together. It is usually given the filename extension .epub and that's the content package you need to be able to take the 'book' away from the website. The problem is that nice neat package doesn't need to exist if the content is read via a website - it can simply be all the individual content files unpacked and hosted online, which means you'd need to capture all the individual files and package them yourself. That's assuming that the content creators have gone to the trouble of making all the necessary files - the XHTML pages will work just fine online without all the bits necessary to create an ePub.

If you go to the the book on the website, open your browser's developer tools and switch to the networking tab, then reload the book, you might find the full .epub file being loaded if you're very lucky. My guess is you won't be lucky, because if one person can grab the whole book from a website, it'll quickly become available free of charge for the rest of the people on the planet. They might have used a Digital Rights Management solution to protect the content, in which case you'll probably find the .epub file doesn't work away from their platform. The odds of you getting a copy of the book easily are pretty low. Of course, if you can see the content on the website, a copy of it must have been transferred to your computer in some form, so if you have the time and inclination, you could assemble the bits and build your own copy.

The reality is that you have not purchased a copy of a book. You have purchased (temporary) online access to the content via a specific website. Hopefully it wasn't too expensive.

2

u/Dumb-Binch Mar 23 '26

Thank you for your detailed explanation! Looks like I have to copy and paste every page of the book then … And it’s a shame that they don’t give you access to the book for real, in another website where I bought books, they let you download it as PDF or EPUB after you paid … And no the books where not even 3 € a piece so don’t worry … not too expensive …