I converted LZMA-JS to a TypeScript node module. I have several projects that need to store compressed JSON data. I found the library but wanted a more simple-to-use TypeScript version. So, I converted it all into TypeScript and wrapped it together inside a helper class.
Some changes I made include:
- The library can be imported anywhere. It does not try to start a worker like the original.
- All methods other than the ones needed by the user are made private with ‘#’.
- The module exports a class instead of an object like the original. Meaning the module is converted to ES6 syntax.
- The helper class makes it easy to read and write json data without thinking about the compression.
- The compressor and decompressor can be easily taken out of the repo and used for anything else. They are not tied to the helper class or each other.