
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
github.com/shogo82148/go-imageflux
URL builder and parser for ImageFlux.
ImageFlux is Image Conversion & Distribution Engine. This allows you to easily generate images optimized for each device based on a single source image, and delivers them quickly and with high quality.
The imageflux package builds and parse URLs for ImageFlux.
In ImageFlux, parameters for image transformation are embedded in the URL.
proxy := &imageflux.Proxy{
Host: "demo.imageflux.jp",
}
cfg := &imageflux.Config{
// resize the image to 200px width.
Width: 200,
// convert the image to WebP format.
Format: imageflux.FormatWebPAuto,
}
u := proxy.Image("/images/1.jpg", cfg).SignedURL()
fmt.Println(u)
// Output:
// https://demo.imageflux.jp/c/w=200,f=webp:auto/images/1.jpg
By attaching a signature to the transformation parameters, it prevents third parties from rewriting the URL.
proxy := &imageflux.Proxy{
Host: "demo.imageflux.jp",
Secret: "testsigningsecret",
}
cfg := &imageflux.Config{
// resize the image to 200px width.
Width: 200,
}
u := proxy.Image("/images/1.jpg", cfg).SignedURL()
fmt.Println(u)
// Output:
// https://demo.imageflux.jp/c/sig=1.tiKX5u2kw6wp9zDgl1tLiOIi8IsoRIBw8fVgVc0yrNg=,w=200/images/1.jpg
proxy := &imageflux.Proxy{}
image, err := proxy.Parse("/c/w=200/images/1.jpg", "")
if err != nil {
log.Fatal(err)
}
fmt.Printf("path = %s\n", image.Path)
fmt.Printf("width = %d\n", image.Config.Width)
// Output:
// path = /images/1.jpg
// width = 200
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.