filesystem

package
v0.0.0-...-dfce1b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfoResponse

type FileInfoResponse struct {
	Name  string `json:"name"`
	IsDir bool   `json:"isDir"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(logger *zap.SugaredLogger) (*Service, error)

func (*Service) List

func (s *Service) List(dirpath string) (*[]FileInfoResponse, error)

func (*Service) MakeDir

func (s *Service) MakeDir(dirpath string) error

func (*Service) Read

func (s *Service) Read(path string) (string, error)

Method used for reading UTF-8 data from files.

func (*Service) ReadBase64

func (s *Service) ReadBase64(path string) (string, error)

We need to handle non-utf8 data, so we encode the data to base64. This can be used to transfer binary data and data incompatible with utf-8.

func (*Service) Remove

func (s *Service) Remove(path string) error

func (*Service) WatchDir

func (s *Service) WatchDir(ctx context.Context, dirpath string) (*rpc.Subscription, error)

Subscription

func (*Service) Write

func (s *Service) Write(path string, content string) error

Because the []byte(content) is representing each char in content as utf-8 bytes we cannot use this to transfer non-utf8 data.

func (*Service) WriteBase64

func (s *Service) WriteBase64(path string, content string) error

Use this method if you need to transfer non-utf8 data. You need to encode the data to base64 before sending it to this method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL