staticFile

command
v0.0.0-...-36af1b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

How to run

  • navigate to current directory
    cd file/staticFile
  • start staticFile server
    go run main.go

FS

type FS struct {
    noCopy nocopy.NoCopy
    Root string
    IndexNames []string
    GenerateIndexPages bool
    Compress bool
    AcceptByteRange bool
    PathRewrite PathRewriteFunc
    PathNotFound HandlerFunc
    CacheDuration time.Duration
    CompressedFileSuffix string
    once sync.Once
	h    HandlerFunc
}
  • Root: Path to the root directory to serve files from.
  • IndexNames: set indexNames, when you access the directory, you will get one of the file in the slice.
  • GenerateIndexPages: set GenerateIndexPages true, when you access the directory, you will get the index(without IndexNames).
  • Compress: set the compress true, server adds a CompressedFileSuffix suffix to the original file name.
  • CompressedFileSuffix: server attempts to save the resulting compressed file under the new file name.
  • AcceptByteRange: enables clients to request a specific range of bytes from a file on the server.
  • PathRewrite: use NewPathSlashesStripper to set this filed, it returns path rewriter, which strips slashesCount.
  • PathNotFound: PathNotFound fires when file is not found in filesystem
  • CacheDuration: set the time interval for automatically closing inactive file handlers.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL