diff options
Diffstat (limited to 'worker')
-rw-r--r-- | worker/lib/parse.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/worker/lib/parse.go b/worker/lib/parse.go index 1c0e413c..5d95046c 100644 --- a/worker/lib/parse.go +++ b/worker/lib/parse.go @@ -1,6 +1,7 @@ package lib import ( + "bufio" "bytes" "errors" "fmt" @@ -271,3 +272,13 @@ func MessageInfo(raw RawMessage) (*models.MessageInfo, error) { Error: parseErr, }, nil } + +// NewCRLFReader returns a reader with CRLF line endings +func NewCRLFReader(r io.Reader) io.Reader { + var buf bytes.Buffer + scanner := bufio.NewScanner(r) + for scanner.Scan() { + buf.WriteString(scanner.Text() + "\r\n") + } + return &buf +} |