Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support gzip in data: uri #76

Closed
hrgdavor opened this issue Jan 17, 2024 · 0 comments · Fixed by #80
Closed

support gzip in data: uri #76

hrgdavor opened this issue Jan 17, 2024 · 0 comments · Fixed by #80

Comments

@hrgdavor
Copy link
Owner

hrgdavor commented Jan 17, 2024

as discussed here jscad/OpenJSCAD.org#1318 (comment)

it would be nice if jscad.app would unzip the script when mime type is application/gzip

I just took a script from jscad examples (gears)

content size bytes size bytes urlencoded
script raw 5.320 7.906
base64 7.096 7.104
gzip&base64 2.344 2.486

I was surprised to see urlencoding original script (7.9) is more overhead than base64 and then urlencode (7.1 k)

unless I miscalculated sth, gzip+b64 looks worth it

hrgdavor added a commit that referenced this issue Jan 22, 2024
fixes: #76

here is a sample gzipped script:

`data:application/gzip;base64,H4sICN1FqGUAA3Rlc3QADcrBDkAwDADQu6/YjV3GxUUi8SuLFRXrpl1FIv6dd34xBT3AwZ0TFxkXpblgIhM9UmMfhqJMhuFUZGjqaZfZhzamAAfSWluXGSMWvECc5A3+9LAPqDKYvnvtW33S8ZutYgAAAA==`

for script:
```js
module.exports=function main(){return require('@jscad/modeling').primitives.sphere({radius: 50})}
```

@Hermann-SW works temporarily here(you may need to hit ctrl+F5) until
merged and published to jscad.app


https://3d.hrg.hr/jscad/app1/#data:application/gzip;base64,H4sICN1FqGUAA3Rlc3QADcrBDkAwDADQu6/YjV3GxUUi8SuLFRXrpl1FIv6dd34xBT3AwZ0TFxkXpblgIhM9UmMfhqJMhuFUZGjqaZfZhzamAAfSWluXGSMWvECc5A3+9LAPqDKYvnvtW33S8ZutYgAAAA==

---------

Co-authored-by: Kenny Daniel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant