Documentation
¶
Overview ¶
// tarfs 包实现了 tar 档案的只读内存表示
Index ¶
- type File
- func (f *File) Close() error
- func (f *File) Name() string
- func (f *File) Read(p []byte) (n int, err error)
- func (f *File) ReadAt(p []byte, off int64) (n int, err error)
- func (f *File) Readdir(count int) ([]os.FileInfo, error)
- func (f *File) Readdirnames(n int) ([]string, error)
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) Sync() error
- func (f *File) Truncate(size int64) error
- func (f *File) Write(p []byte) (n int, err error)
- func (f *File) WriteAt(p []byte, off int64) (n int, err error)
- func (f *File) WriteString(s string) (ret int, err error)
- type Fs
- func (fs *Fs) Chmod(name string, mode os.FileMode) error
- func (fs *Fs) Chown(name string, uid, gid int) error
- func (fs *Fs) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (fs *Fs) Create(name string) (afero.File, error)
- func (fs *Fs) Mkdir(name string, perm os.FileMode) error
- func (fs *Fs) MkdirAll(path string, perm os.FileMode) error
- func (fs *Fs) Name() string
- func (fs *Fs) Open(name string) (afero.File, error)
- func (fs *Fs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (fs *Fs) Remove(name string) error
- func (fs *Fs) RemoveAll(path string) error
- func (fs *Fs) Rename(oldname string, newname string) error
- func (fs *Fs) Stat(name string) (os.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File 代表 tar 文件系统中的文件结构
func (*File) ReadAt ¶
ReadAt 从文件的特定偏移量处读取数据到 p 中 参数:
- p: []byte 读取的数据存储到 p 中
- off: int64 偏移量
返回值:
- n: int 读取的字节数
- err: 错误信息
func (*File) Readdirnames ¶
Readdirnames 读取目录内容并返回文件名列表 参数:
- n: int 读取的文件数量
返回值:
- []string: 文件名列表
- error: 错误信息
func (*File) Seek ¶
Seek 移动文件的读取指针到指定位置 参数:
- offset: int64 偏移量
- whence: int 偏移的起始位置
返回值:
- int64: 新的偏移位置
- error: 错误信息
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs 代表一个只读的内存中的 tar 文件系统
func (*Fs) Chmod ¶
Chmod 更改文件权限(只读文件系统,返回错误) 参数:
- name: string 文件路径
- mode: os.FileMode 文件权限
返回值:
- error: 错误信息
func (*Fs) Chown ¶
Chown 更改文件所有者(只读文件系统,返回错误) 参数:
- name: string 文件路径
- uid: int 用户ID
- gid: int 组ID
返回值:
- error: 错误信息
func (*Fs) Chtimes ¶
Chtimes 更改文件时间(只读文件系统,返回错误) 参数:
- name: string 文件路径
- atime: time.Time 访问时间
- mtime: time.Time 修改时间
返回值:
- error: 错误信息
func (*Fs) Create ¶
Create 创建新文件(只读文件系统,返回错误) 参数:
- name: string 文件路径
返回值:
- afero.File: 创建的文件
- error: 错误信息
func (*Fs) Mkdir ¶
Mkdir 创建目录(只读文件系统,返回错误) 参数:
- name: string 目录路径
- perm: os.FileMode 目录权限
返回值:
- error: 错误信息
func (*Fs) MkdirAll ¶
MkdirAll 创建所有目录(只读文件系统,返回错误) 参数:
- path: string 目录路径
- perm: os.FileMode 目录权限
返回值:
- error: 错误信息
func (*Fs) OpenFile ¶
OpenFile 打开文件(只读模式) 参数:
- name: string 文件路径
- flag: int 打开文件的标志
- perm: os.FileMode 文件权限
返回值:
- afero.File: 打开的文件
- error: 错误信息
Click to show internal directories.
Click to hide internal directories.