curly

command
v0.0.0-...-1e84083 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 14 Imported by: 0

README

https://medium.com/go-walkthrough/go-walkthrough-io-package-8ac5e95a9fbd#.d2ebstv0q

  1. Implement a curl-like CLI tool (let’s name it curly) that downloads a file from the provided URL. By default, curly sends the output to /dev/null and sets exit code to 0 if download was successful, 1 if failed + prints error to stderr. But if -output=FILE flag is set - tool should store the contents of URL to the FILE. If “-output=-” tool should print output to stdout
  2. Add flag -md5, so if set md5 sum will be printed to Stderr
  3. Add flag -output-chunked FILEPREFIX - if set - content should be splitted to 3.5 Mb files FILEPREFIX.0 FILEPREFIX.1 ... FILEPREFIX.N so it could be stored on floppy disks 🙂. output-chunked should work together with other flags!
wget https://play.golang.org/p/HmnNoBf0p1z; md5sum HmnNoBf0p1z
# 474b18855ceed917e30c29b98dcc1854

go run main.go --md5=true https://play.golang.org/p/HmnNoBf0p1z
go build
./curly --output=foobig --output-chunked=foo --md5=true https://i.redd.it/dujlhm3dqh951.png
./curly  -md5 -upload -uploadurl=http://localhost:25478/upload?token=f9403fc5f537b4ab332d https://i.redd.it/dujlhm3dqh951.png

# d41d8cd98f00b204e9800998ecf8427e

cat foo.0 foo.1 foo.2 foo.3 foo.4 foo.5 foo.6 foo.7 foo.8 foo.9 foo.10 foo.11 foo.12 > mergedfoo
# md5sum mergedfoo
b4be6a7103e47d6f8fe247d66d797bbd 

#md5sum foobig
b4be6a7103e47d6f8fe247d66d797bbd  foobig

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
tee

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL