maildir: don't read the full file into memory
This commit is contained in:
parent
db6848fe1b
commit
8ecf0b73f4
1 changed files with 2 additions and 8 deletions
|
@ -1,10 +1,9 @@
|
||||||
package maildir
|
package maildir
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
|
|
||||||
"github.com/emersion/go-maildir"
|
"github.com/emersion/go-maildir"
|
||||||
"github.com/emersion/go-message"
|
"github.com/emersion/go-message"
|
||||||
|
@ -26,12 +25,7 @@ func (m Message) NewReader() (io.Reader, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
return bufio.NewReader(f), nil
|
||||||
b, err := ioutil.ReadAll(f)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return bytes.NewReader(b), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flags fetches the set of flags currently applied to the message.
|
// Flags fetches the set of flags currently applied to the message.
|
||||||
|
|
Loading…
Reference in a new issue