summaryrefslogtreecommitdiffstats
path: root/app/file.go
diff options
context:
space:
mode:
authorHyeseong Kim <cometkim.kr@gmail.com>2018-07-25 03:23:54 +0900
committerChristopher Speller <crspeller@gmail.com>2018-07-24 11:23:54 -0700
commit8387d92ea22562162a00fae60286dc6ec68942c1 (patch)
tree2fc9192acd835f217fc3e911c2eb6f44702ecedc /app/file.go
parentc8d3e421391520af45d8e0f60a884fee139652a0 (diff)
downloadchat-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.go8
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 {