Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileWriter ¶
type FileWriter struct { nocopy.NoCopy io.WriteCloser // contains filtered or unexported fields }
func (*FileWriter) GetDownloadToken ¶
func (fw *FileWriter) GetDownloadToken(downloadFileName string, expireIn time.Duration) (string, error)
GetDownloadToken generates a download token for downloading this file later. The downloading can be handled by the Handler.HandleDownloadRequest.
func (*FileWriter) Remove ¶
func (fw *FileWriter) Remove()
type Handler ¶
Handler provides a file-based data serving HTTP handler. Arbitrary data stream can be stored in the file in encrypted form temporarily, and then downloaded by the user later. As data is stored in the file, large chunk of data is supported.
Note: the download token cannot be mixed in different Handler instances.
func (*Handler) HandleDownloadRequest ¶
HandleDownloadRequest handles a gin Request for serving the file in the FS by using a download token. The file will be removed after it is successfully served to the user.
func (*Handler) NewFileWriter ¶
func (s *Handler) NewFileWriter(tempFilePattern string) (*FileWriter, error)
NewFileWriter creates a writer for storing data into FS. A download token can be generated from the writer for downloading later. The downloading can be handled by the HandleDownloadRequest.