jamsinclair / jSquash

Browser & Web Worker focussed wasm bundles derived from the Squoosh App.
Apache License 2.0
222 stars 14 forks source link

How can I create my own CDN version and host on my server ? #60

Closed sbonilla-godaddy closed 1 month ago

sbonilla-godaddy commented 1 month ago

How can I create and host my own CDN version on my server?

jamsinclair commented 1 month ago

Hi @sbonilla-godaddy, this project contains only image codec libraries. These libraries allow images to be encoded or decoded in the Web Browser with JavaScript.

What are you wanting to host with the CDN? Is it Images?

You'll need to research and find the appropriate service to do that. I can recommend Cloudflare, as they have a free service that can automatically cache and host images on your web domains.

I'll close this issue as I don't think it's relevant. Best of luck with your project!

sbonilla-godaddy commented 1 month ago

Hi @jamsinclair I mean I cdn like this one https://unpkg.com/@jsquash/jpeg?module but I want to host in my server

example:

https://myserver.com/@jsquash/jpeg?module

jamsinclair commented 1 month ago

The code for that "Content Delivery Network" is open source and can be found at https://github.com/mjackson/unpkg.

At its simplest you could host the static files directly on your server. It's the building blocks of web technology. Then you could import the scripts directly in your JavaScript files. e.g.

import { encode } from 'https://myserver.com/@jsquash/jpeg/index.js'

The question is, do you really need to? If it's for personal use you would be better off bundling the assets with a tool like vite or webpack for your project, or consume the existing CDN.

Unfortunately, we're a bit off topic for this project. I don't think I can offer much more guidance. I think those resources should definitely help you in your learning and understanding. Good luck!