diff options
author | Reto Brunner <reto@labrat.space> | 2021-02-08 09:06:25 +0100 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2021-02-08 09:06:42 +0100 |
commit | 8ecf0b73f41f9319f9d89d61f8d4619aa4e69758 (patch) | |
tree | 645df6dc75b9c67a34b9804a6a95f408e2ab2f2c /worker/maildir | |
parent | db6848fe1b77bc7f2a657231307d2a4271d41482 (diff) | |
download | aerc-8ecf0b73f41f9319f9d89d61f8d4619aa4e69758.tar.gz |
maildir: don't read the full file into memory
Diffstat (limited to 'worker/maildir')
-rw-r--r-- | worker/maildir/message.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/worker/maildir/message.go b/worker/maildir/message.go index 55e2613b..b3c2e8ff 100644 --- a/worker/maildir/message.go +++ b/worker/maildir/message.go @@ -1,10 +1,9 @@ package maildir import ( - "bytes" + "bufio" "fmt" "io" - "io/ioutil" "github.com/emersion/go-maildir" "github.com/emersion/go-message" @@ -26,12 +25,7 @@ func (m Message) NewReader() (io.Reader, error) { if err != nil { return nil, err } - defer f.Close() - b, err := ioutil.ReadAll(f) - if err != nil { - return nil, err - } - return bytes.NewReader(b), nil + return bufio.NewReader(f), nil } // Flags fetches the set of flags currently applied to the message. |