From 8387d92ea22562162a00fae60286dc6ec68942c1 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Wed, 25 Jul 2018 03:23:54 +0900 Subject: 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 --- app/file.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/file.go') 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 { -- cgit v1.2.3-1-g7c22