Documentation
¶
Index ¶
- type GCSFS
- func (fsys *GCSFS) Close() error
- func (fsys *GCSFS) Context() context.Context
- func (fsys *GCSFS) CreateFile(name string, mode fs.FileMode) (wfs.WriterFile, error)
- func (fsys *GCSFS) Glob(pattern string) ([]string, error)
- func (fsys *GCSFS) MkdirAll(dir string, mode fs.FileMode) error
- func (fsys *GCSFS) Open(name string) (fs.File, error)
- func (fsys *GCSFS) ReadDir(dir string) ([]fs.DirEntry, error)
- func (fsys *GCSFS) ReadFile(name string) ([]byte, error)
- func (fsys *GCSFS) RemoveAll(dir string) error
- func (fsys *GCSFS) RemoveFile(name string) error
- func (fsys *GCSFS) Stat(name string) (fs.FileInfo, error)
- func (fsys *GCSFS) Sub(dir string) (fs.FS, error)
- func (fsys *GCSFS) WithClient(client *storage.Client) *GCSFS
- func (fsys *GCSFS) WithContext(ctx context.Context) *GCSFS
- func (fsys *GCSFS) WriteFile(name string, p []byte, mode fs.FileMode) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GCSFS ¶
type GCSFS struct { // DirOpenBufferSize is the buffer size for using objects as the directory. (Default 100) DirOpenBufferSize int // contains filtered or unexported fields }
GCSFS represents a filesystem on GCS (Google Cloud Storage).
func NewWithClient ¶
NewWithClient returns a filesystem for the tree of objects rooted at the specified bucket with *storage.Client. The specified client will be closed by Close.
ctx := context.Background() client, err := storage.NewClient(ctx) if err != nil { log.Fatal(err) } fsys := gcsfs.NewWithClient("<your-bucket>", client).WithContext(ctx) defer fsys.Close() // Close closes the specified client.
func (*GCSFS) Context ¶
Context returns a holded context. If this filesystem has no context then context.Background() will use.
func (*GCSFS) CreateFile ¶
CreateFile creates the named file. The specified mode is ignored.
func (*GCSFS) Glob ¶
Glob returns the names of all files matching pattern, providing an implementation of the top-level Glob function.
func (*GCSFS) ReadDir ¶
ReadDir reads the named directory and returns a list of directory entries sorted by filename.
func (*GCSFS) RemoveFile ¶
RemoveFile removes the specified named file.
func (*GCSFS) Stat ¶
Stat returns a FileInfo describing the file. If there is an error, it should be of type *PathError.
func (*GCSFS) WithClient ¶
WithClient holds the specified client. The specified client is closed by Close.
func (*GCSFS) WithContext ¶
WithContext holds the specified context.