Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/rickb777/servefiles/v3

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/rickb777/servefiles/v3

  • v3.7.5
  • Source
  • Go
  • Socket score

Version published
Created
Source

servefiles

GoDoc Build Status Coverage Status Go Report Card Issues

Serve static files from a Go http server, including performance-enhancing features.

  • Based on the standard net/http ServeFiles, with gzip/brotli and cache performance enhancements.

Please see the GoDoc for more.

Installation

go get -u github.com/rickb777/servefiles/v3

MaxAge

User agents can cache responses. This http server enables easy support for two such mechanisms:

  • Conditional requests (using etags) allow the response to be sent only when it has changed
  • Cache-Control max-age response headers allow the user agent to cache entities until some expiry time.

Note that conditional requests RFC9110 and max-age caching (RFC9111) can work together as required. Conditional requests still require network round trips, whereas caching removes all network round-trips until the entities reach their expiry time.

Echo Adapter

Sub-package echo_adapter provides integration hooks into the Echo web framework. This makes it easy for Echo code to use this asset handler also: see the example in the sub-package for more info.

Gin Adapter

Sub-package gin_adapter provides integration hooks into the Gin web framework. This makes it easy for Gin code to use this asset handler also: see the example in the sub-package for more info.

v3

Version 3 brings Go module support. Also, brotli encoding is supported alongside gzip encoding. Brotli now has widespread implementation in most browsers. You can compress your textual assets (including Javascript, CSS, HTML, SVG etc) using Brotli and/or Gzip as part of your build pipeline, uploading both the original and compressed files to your production server's asset directories. Brotli compression takes longer than Gzip but produces more compact files. Compression is, of course, optional.

Earlier versions

Earlier versions do not support Go modules, nor brotli encoding, although gzip encoding is supported.

Status

This library has been in reliable production use for some time. Versioning follows the well-known semantic version pattern.

Licence

MIT

FAQs

Package last updated on 12 Jul 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc