Skip to content

Commit

Permalink
Updated readme and makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanjain28 committed Sep 9, 2017
1 parent 2f9d1fd commit a485a5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 55 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ $(PACKAGE)-$(VERSION)-linux-386:
$(PACKAGE)-$(VERSION)-windows-amd64.exe:
GOOS=windows \
GOARCH=amd64 \
go build -o=$@.exe
go build -o=$@

$(PACKAGE)-$(VERSION)-windows-386.exe:
GOOS=windows \
GOARCH=386 \
go build -o=$@.exe
go build -o=$@

dist-clean:
rm -f $(ARCH_WIN) $(ARCH_LINUX)
65 changes: 12 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pluto
A CLI and Library for lightning fast, aggressive and reliable downloads.

Pluto is a Multipart File Downloader. It comes in form of a package and a CLI. It works by dividing the file into a given number of parts, Each part is given a range of bytes to download, Once all the downloads are complete, it stiches all of them together in correct order to generate the file.
Pluto is a Multipart File Downloader. It comes in form of a package and a CLI. It works by dividing the file into a given number of parts, Each part is given a range of bytes to download, As all the parts are downloading they are also written to the saveFile in correct order.

There are a lot of tool similar and better than Pluto but most of them have an upper limit of 16 or 32 parts whereas Pluto has no upper limit.

Expand All @@ -19,72 +19,31 @@ There are a lot of tool similar and better than Pluto but most of them have an u

### CLI Example

pluto --help
Usage of pluto:
-part int
Number of Download parts (default 16)
-name string
Path or Name of save File
-part uint
Number of Download parts (default 32)
-verbose
Enable Verbose Mode



pluto --part=10 [urls ...]
$ pluto [OPTIONS] [URLs...]


### Package Example:

package main

import (
"flag"
"io"
"log"
"os"

"github.com/ishanjain28/pluto/pluto"
)

func main() {

u := flag.String("url", "", "Download link of a file")

parts := flag.Int("part", 16, "Number of Download parts")

flag.Parse()
if *u == "" {
log.Fatalln("no url provided")
}

f, err := pluto.Download(*u, *parts)
if err != nil {
log.Fatalln(err)
}
defer f.Close()
// A copy of completed file is saved in Temp Directory, It is usually deleted automatically
// But you can do so manually if you want
defer os.Remove(f.Name())

file, err := os.Create("downloaded_file")
if err != nil {
log.Fatalln(err.Error())
}

defer file.Close()

_, err = io.Copy(file, f)
if err != nil {
log.Fatalln(err.Error())
}
}

See pluto_cli.go for an example of this package



## Default Behaviours

1. When an error occurs in downloading stage of a part, It is automatically retried, unless there is an error that retrying won't fix. For example, If the server sends a 404, 400 or 500 HTTP response, It stop and return an error.

2. To keep RAM usage to a minimum, One file is created for each part in temporary directory. All the data downloaded is then copied to these files. When all the parts finish downloading, A new temporary file is created and data from all different parts is written to this file and a pointer to it is returned.
2. To keep RAM usage to a minimum, Only 64kilobytes of data is read at a time from HTTP connection and written to file.

3. When a part download fails for reason that is recoverable(see 1) reason, All the data downloaded until the point of error is discarded and then that part is redownloaded.
3. When a part download fails for reason that is recoverable(see 1) reason, Only the bytes that have not been downloaded yet are requested from server.


## Motivation
Expand All @@ -98,7 +57,7 @@ Almost all Download Managers have an upper limit on number of parts. This is usu
But when I am downloading a file from my private servers I need the absolute maximum speed and I could not find a good tool for it. So, I built one myself. A benchmark b/w Pluto, axel and aria2c will be added shortly.


##### Please use this package responsibly because it can cause all the bad things mentioned above
##### Please use this package responsibly because it can cause all the bad things mentioned above and if you encounter any problems, Feel free to create an issue.

# License

Expand Down

0 comments on commit a485a5c

Please sign in to comment.