Documentation ¶
Overview ¶
Package ios 输入输出相关.
包括 ReadLine, ContainsReader, WalkDir.
Index ¶
- Constants
- func NewWriter(file string) (io.WriteCloser, error)
- func ReadLine(file string, call func(line string) error) error
- func ReaderLine(reader io.Reader, call func(line string) error) error
- func Unit(size int64, prec int) string
- func WalkDir(root string, walkDirFunc fs.WalkDirFunc, level int) error
- type ContainsReader
Examples ¶
Constants ¶
View Source
const ( Kilo Meg Giga Tera Peta Exa )
Variables ¶
This section is empty.
Functions ¶
func NewWriter ¶ added in v0.2.19
func NewWriter(file string) (io.WriteCloser, error)
NewWriter 新建Writer,file存在Seek末尾,不存在创建.
func Unit ¶ added in v0.5.41
Example ¶
package main import ( "fmt" "github.com/xuender/oils/ios" ) func main() { fmt.Println(ios.Unit(1, 2)) fmt.Println(ios.Unit(100, 2)) fmt.Println(ios.Unit(1024, 2)) fmt.Println(ios.Unit(1700, 2)) fmt.Println(ios.Unit(3*ios.Meg, 2)) }
Output: 1B 100B 1KB 1.7KB 3MB
Types ¶
type ContainsReader ¶
type ContainsReader struct {
// contains filtered or unexported fields
}
func NewContainsReader ¶
func NewContainsReader(reader io.Reader, subslice []byte) *ContainsReader
func (*ContainsReader) Contains ¶
func (p *ContainsReader) Contains() bool
Click to show internal directories.
Click to hide internal directories.