Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Working without filesystem #52

Closed
owulveryck opened this issue Oct 3, 2021 · 4 comments
Closed

Working without filesystem #52

owulveryck opened this issue Oct 3, 2021 · 4 comments
Assignees

Comments

@owulveryck
Copy link
Collaborator

I am trying to compile my tool into webassembly.

The problem is that this library is using temporary files on the fs, and this is forbidden by webassembly.

I could be nice to add an option to deal with the media in a pseudo memory fs.

This would lead to a new write method that could take an io.Writer as a parameter (and eventually deprecating the WriteFile method).

I can make a POC when I have time if you are interested (and you can assign this issue to me)

@bmaupin
Copy link
Owner

bmaupin commented Oct 4, 2021

That sounds great. My first concern would be memory usage, but we're already storing most of the content of the EPUB in memory anyway, aside from images and fonts (off the top of my head) so it doesn't seem like it would really be an issue. I like the flexibility of doing this in memory.

There was a fork of this library that implemented something like this already in case it's useful: arkhaix@8516118

They added benchmarks too 😎 arkhaix@9cc858f

@owulveryck
Copy link
Collaborator Author

I still need to think about it, but my idea is to use an abstraction and a kind of ‘Register’ function that would allow switching from an implementation to the other.

@owulveryck
Copy link
Collaborator Author

owulveryck commented Oct 12, 2021

PR #54 is in draft.
So far, the abstraction is done an allows switching from a plain FS to a Memory FS easily.
I made the change to the Write* methods to use the abstraction.

TODO:

  • The tests are failing on windows, I need to investigate (I don't have a windows box, I will figure it out)
  • The cover CSS generation in the main EPUB creation is using a tempfile, I need to get rid of this as well
  • Add benchmarks

Meanwhile, I guess that the abstraction mechanism won't change, anybody's welcome to comment the PR.

@bmaupin
Copy link
Owner

bmaupin commented Oct 21, 2021

I wasn't sure if #54 fully covered this issue so I left it open. Feel free to close if it's done. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants