Skip to content

Commit

Permalink
Merge pull request #64 from xushiwei/cached
Browse files Browse the repository at this point in the history
x/http/fs/cached.RemoteOf/IsOffline
  • Loading branch information
xushiwei authored Sep 4, 2023
2 parents fc27c18 + 76039e2 commit d25681c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions http/fs/cached/cached.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ func New(local string, remote Remote, offline ...bool) http.FileSystem {
return &fsCached{local, remote, isOffline}
}

func RemoteOf(fs http.FileSystem) (r Remote, ok bool) {
c, ok := fs.(*fsCached)
if ok {
r = c.remote
}
return
}

func IsOffline(fs http.FileSystem) bool {
if c, ok := fs.(*fsCached); ok {
return c.offline
}
return false
}

func (p *fsCached) Open(name string) (file http.File, err error) {
remote, local := p.remote, p.local
localFile := filepath.Join(local, name)
Expand Down

0 comments on commit d25681c

Please sign in to comment.