mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add files cache for reading template tar archives from db (#17141)
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package archivefs
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"io"
|
||||
"io/fs"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/afero/tarfs"
|
||||
)
|
||||
|
||||
func FromTarReader(r io.Reader) fs.FS {
|
||||
tr := tar.NewReader(r)
|
||||
tfs := tarfs.New(tr)
|
||||
rofs := afero.NewReadOnlyFs(tfs)
|
||||
return afero.NewIOFS(rofs)
|
||||
}
|
||||
Reference in New Issue
Block a user