mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			431 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			431 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package target
 | |
| 
 | |
| import (
 | |
| 	"bytes"
 | |
| 	"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
 | |
| }
 |