MaweJS and gzip'd files #344
mkoskim
started this conversation in
Development
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Compressed files
MaweJS can read and write gzip'd files natively.
History
Reading gzip'd file: The feature was originally meant just to be able to read compressed files. When saving space (e.g. when storing stories to network drives), you may want to compress files from command line:
As you know,
gzip
adds suffix.gz
to compressed file by renaming it, andgunzip
removes the suffix.MaweJS does not use suffix, but it determines if the content is compressed by checking the file content:
https://github.com/mkoskim/mawejs/blob/master/src/document/util.js#L40
This means, that
mystory.mawe
can be compressed or uncompressed, as well asmystory.mawe.gz
- it does not matter.Writing gzip'd files: Later, I added a feature, that when saving the file, we decide if we write compressed or uncompressed buffer from file extension:
https://github.com/mkoskim/mawejs/blob/master/src/document/util.js#L62
This feature was implemented, so that if you have created compressed files with
gzip
, MaweJS keeps the content compressed.Beta Was this translation helpful? Give feedback.
All reactions