mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-26 23:04:38 +01:00
25 lines
388 B
Go
25 lines
388 B
Go
package pages
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
// StaticFile is a static file.
|
|
type StaticFile struct {
|
|
file
|
|
}
|
|
|
|
// Static is in the File interface.
|
|
func (p *StaticFile) Static() bool { return true }
|
|
|
|
func (p *StaticFile) Write(w io.Writer) error {
|
|
in, err := os.Open(p.filename)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer in.Close() // nolint: errcheck, gas
|
|
_, err = io.Copy(w, in)
|
|
return err
|
|
}
|