/gwriter

go module gwriter

Primary LanguageGoMIT LicenseMIT

Go module for appending files

Build Status GoDoc Go Report Card GitHub license

func ExampleNewWriter() {
	conf := config.Config{
		PathTpl:  "{dir}/{filename}{base_ext}{write_ext}",
		BaseExt:  ".msg",
		WriteExt: "",
		PathInfo: map[string]string{
			"{dir}":      os.Getenv("DIR"),
			"{filename}": os.Getenv("FILENAME"),
		},
		UpdateMoment: "00:01:00",
	}

	writer := NewWriter("test-file", conf)
	writer.Start()
	writer.WriteString("this is string")
	writer.WriteBytes([]byte("this is bytes"))
	writer.Stop()
}