Skip to content
This repository was archived by the owner on Oct 23, 2020. It is now read-only.

jacobsantos/carnegie-coding-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Carnegie Coding Check - Multi-Get

Specification

An application that downloads parts of a file from a web server.

  1. Download complete file.
  2. Download part of a file using the 'Range' header.
  3. Only download the first 4MiB in 1MiB chunks.
  4. Write to disk.

Requirements

  1. Source specified by cli option.
  2. File is downloaded in 4 parts (4 requests to server).
  3. Only the first 4MiB of the file should be downloaded.
  4. Output file may be specified with a cli option.
  5. Output file may have default.
  6. No corruption.
  7. File retrieved using GET requests.

Optional

  1. Parallel download
  2. Support files smaller than 4MiB
  3. Configurable number of chunks, chunk size, and total download size.

Out of Scope

  1. HTTPS
  2. Range header unsupported/fallback
  3. Other HTTP methods
  4. Re-use existing connections with keep-alive

Application Requirements

  1. PHP 7.1

Setup

php composer.phar install

CLI Commands

There is only one command supported.

Download

bin/download
    --url=URL STRING
    [--output=FILE PATH]
    [--parts=NUMBER|4]
    [--part-size=NUMBER|1MiB]
    [--download-size=NUMBER|4MiB]
  • --url (STRING) required

    Address to download file.

  • --output (STRING) optional

    Path to file on file system. Will overwrite file.

      Defaults to ./ccc.file.
    
  • --parts (NUMBER) optional

    Number of requests in order to chunk the file downloaded.

      Defaults to 4.
    
  • --part-size (NUMBER) optional

    Number of bytes for each chunk.

      Defaults to 1MiB.
    
  • --download-size (NUMBER) optional

    Number of bytes to download in total.

      Defaults to 4MiB.
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages