unjs / unstorage

💾 Unstorage provides an async Key-Value storage API with conventional features like multi driver mounting, watching and working with metadata, dozens of built-in drivers and a tiny core.
https://unstorage.unjs.io
MIT License
1.67k stars 123 forks source link

Supporting compression #94

Open manniL opened 1 year ago

manniL commented 1 year ago

Hey all 👋🏻

Right now I am using unstorage and deal with files that are >= 10MB. I realized that they'd be ideal for compression and was wondering if it'd make sense to have a built-in compression handling. The major would be to keep that universal, but having it for fs only would suffice too from my POV.

pi0 commented 1 year ago

Similar to overlay, we can use a compressed driver that wraps another storage instance. (it can be Node.js only for beginning)

storage.mount(compressed(fs({ base: '...' })), { level: 9 })
pi0 commented 1 year ago

(Related: https://github.com/unjs/unstorage/issues/23)