unstorage icon indicating copy to clipboard operation
unstorage copied to clipboard

Supporting compression

Open TheAlexLichter opened this issue 3 years ago • 2 comments

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.

TheAlexLichter avatar Oct 28 '22 21:10 TheAlexLichter

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 avatar Nov 02 '22 09:11 pi0

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

pi0 avatar Nov 02 '22 09:11 pi0