hugo/target/memory.go

25 lines
431 B
Go
Raw Normal View History

package target
import (
"bytes"
2013-10-01 22:59:35 -04:00
"io"
)
type InMemoryTarget struct {
Files map[string][]byte
}
func (t *InMemoryTarget) Publish(label string, reader io.Reader) (err error) {
if t.Files == nil {
t.Files = make(map[string][]byte)
}
bytes := new(bytes.Buffer)
bytes.ReadFrom(reader)
t.Files[label] = bytes.Bytes()
return
}
func (t *InMemoryTarget) Translate(label string) (dest string, err error) {
return label, nil
}