Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (24 sloc) 503 Bytes
// +build !js
package brbundle
import (
"fmt"
"io"
"os"
"path/filepath"
)
func (p *packedFileEntry) GetLocalPath() (string, error) {
etag, _ := p.EtagAndContentType()
path := filepath.Join(os.TempDir(), fmt.Sprintf("%s__%s", etag, p.Name()))
f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, p.Stat().Mode()|0200)
if err != nil {
return "", err
}
defer f.Close()
r, err := p.Reader()
if err != nil {
return "", err
}
defer r.Close()
io.Copy(f, r)
return path, nil
}
You can’t perform that action at this time.