PrismarineJS / node-minecraft-data

Provide easy access to minecraft-data in node.js
https://prismarinejs.github.io/minecraft-data/
100 stars 51 forks source link

publish compressed files ? #185

Open rom1504 opened 2 years ago

rom1504 commented 2 years ago

it would reduce the size of nmd package on disk decompression cost at run time would probably be minimal

wgaylord commented 10 months ago

minecraft-data now takes up over 145MB of space (149360KB) on disk when installed. A way to easily shrink this size without any extra code would be to minify the JSON data before publishing to npm. (Remove the extra new lines that make it human read-able.) This alone shrinks it down to around 115MB (116788KB) Using an actual compression on top of this would be an improvement as well.

rom1504 commented 10 months ago

Files are already published compressed. Npm does that by default

Is your goal to decrease your local node modules space use ?

On Fri, Nov 17, 2023, 19:15 William Gaylord @.***> wrote:

minecraft-data now takes up over 145MB of space (149360KB) on disk when installed. A way to easily shrink this size without and extra code would be to minify the JSON data before publishing to nom. (Remove the extra new lines that make it human read-able.) This alone shrinks it down to around 115MB (116788KB) Using an actual compression on top of this would be an improvement as well.

— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/node-minecraft-data/issues/185#issuecomment-1816881368, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437TIL6LR6MUFZTGVWULYE6SSRAVCNFSM5S7ADWLKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRGY4DQMJTGY4A . You are receiving this because you authored the thread.Message ID: @.***>

wgaylord commented 10 months ago

Thats what I assumed this issue was about, was just giving my input.

jojomatik commented 10 months ago

Thats what I assumed this issue was about, was just giving my input.

Yep, that was the original idea of the issue: https://github.com/PrismarineJS/node-minecraft-protocol/issues/978#issuecomment-1094011178

rom1504 commented 10 months ago

Ah right, forgot I had opened this

rom1504 commented 5 months ago

https://www.npmjs.com/package/node-stream-zip

extremeheat commented 5 months ago

Yeah, publishing a zip seems to be best. node-stream-zip doesn't support sync but it seems https://github.com/cthackers/adm-zip does.

If anyone wants to do it the API seems simple to use also.

rom1504 commented 5 months ago

Another way would be to compress file independently. Kind of same as zip really

Would just need to try out when to run this, eg pre publish post install etc and see loading time and if that breaks web

rom1504 commented 5 months ago

tried there https://github.com/PrismarineJS/node-minecraft-data/pull/346