diff options
author | Hyeseong Kim <cometkim.kr@gmail.com> | 2018-07-25 03:23:54 +0900 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-07-24 11:23:54 -0700 |
commit | 8387d92ea22562162a00fae60286dc6ec68942c1 (patch) | |
tree | 2fc9192acd835f217fc3e911c2eb6f44702ecedc /app/file.go | |
parent | c8d3e421391520af45d8e0f60a884fee139652a0 (diff) | |
download | chat-8387d92ea22562162a00fae60286dc6ec68942c1.tar.gz chat-8387d92ea22562162a00fae60286dc6ec68942c1.tar.bz2 chat-8387d92ea22562162a00fae60286dc6ec68942c1.zip |
MM-10381: Change the file downloading API to stream file (#9144)
* Change the file downloading to stream file
* Change file downloading to chunk only for preview
* Remove unnecessary else case
Diffstat (limited to 'app/file.go')
-rw-r--r-- | app/file.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/file.go b/app/file.go index 95d11afed..537f76aaa 100644 --- a/app/file.go +++ b/app/file.go @@ -70,6 +70,14 @@ func (a *App) ReadFile(path string) ([]byte, *model.AppError) { return backend.ReadFile(path) } +func (a *App) FileReader(path string) (io.Reader, *model.AppError) { + backend, err := a.FileBackend() + if err != nil { + return nil, err + } + return backend.Reader(path) +} + func (a *App) FileExists(path string) (bool, *model.AppError) { backend, err := a.FileBackend() if err != nil { |