mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Renamed Download to Save and changed parameter to io.Writer
This commit is contained in:
parent
77c0ae64b4
commit
22525973c7
1 changed files with 2 additions and 3 deletions
|
|
@ -2,7 +2,6 @@ package crunchyroll
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Subtitle struct {
|
type Subtitle struct {
|
||||||
|
|
@ -13,13 +12,13 @@ type Subtitle struct {
|
||||||
Format string `json:"format"`
|
Format string `json:"format"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Subtitle) Download(file *os.File) error {
|
func (s Subtitle) Save(writer io.Writer) error {
|
||||||
resp, err := s.crunchy.Client.Get(s.URL)
|
resp, err := s.crunchy.Client.Get(s.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
_, err = io.Copy(file, resp.Body)
|
_, err = io.Copy(writer, resp.Body)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue