mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
17 lines
273 B
Go
17 lines
273 B
Go
package archivefs
|
|
|
|
import (
|
|
"archive/tar"
|
|
"io"
|
|
"io/fs"
|
|
|
|
"github.com/spf13/afero"
|
|
"github.com/spf13/afero/tarfs"
|
|
)
|
|
|
|
// FromTarReader creates a read-only in-memory FS
|
|
func FromTarReader(r io.Reader) fs.FS {
|
|
tr := tar.NewReader(r)
|
|
return afero.NewIOFS(tarfs.New(tr))
|
|
}
|