aria2c.rst 132 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872
  1. aria2c(1)
  2. =========
  3. SYNOPSIS
  4. --------
  5. **aria2c** [<OPTIONS>] [<URI>|<MAGNET>|<TORRENT_FILE>|<METALINK_FILE>] ...
  6. DESCRIPTION
  7. -----------
  8. aria2 is a utility for downloading files. The supported protocols are
  9. HTTP(S), FTP, BitTorrent, and Metalink. aria2 can download a file from
  10. multiple sources/protocols and tries to utilize your maximum download
  11. bandwidth. It supports downloading a file from HTTP(S)/FTP and
  12. BitTorrent at the same time, while the data downloaded from
  13. HTTP(S)/FTP is uploaded to the BitTorrent swarm. Using Metalink's
  14. chunk checksums, aria2 automatically validates chunks of data while
  15. downloading a file like BitTorrent.
  16. OPTIONS
  17. -------
  18. Basic Options
  19. ~~~~~~~~~~~~~
  20. .. option:: -d, --dir=<DIR>
  21. The directory to store the downloaded file.
  22. .. option:: -i, --input-file=<FILE>
  23. Downloads URIs found in FILE. You can specify multiple URIs for a single
  24. entity: separate URIs on a single line using the TAB character.
  25. Reads input from stdin when ``-`` is specified.
  26. Additionally, options can be specified after each line of
  27. URI. This optional line must start with one or more white spaces and have
  28. one option per single line.
  29. See `Input File`_ subsection for details.
  30. See also :option:`--deferred-input` option.
  31. .. option:: -l, --log=<LOG>
  32. The file name of the log file. If ``-`` is specified, log is written to
  33. stdout. If empty string("") is specified, log is not written to file.
  34. .. option:: -j, --max-concurrent-downloads=<N>
  35. Set maximum number of parallel downloads for every static (HTTP/FTP) URI,
  36. torrent and metalink. See also :option:`--split <-s>` option.
  37. Default: ``5``
  38. .. option:: -V, --check-integrity[=true|false]
  39. Check file integrity by validating piece hashes or a hash of entire
  40. file. This option has effect only in BitTorrent, Metalink downloads
  41. with checksums or HTTP(S)/FTP downloads with
  42. :option:`--checksum` option. If
  43. piece hashes are provided, this option can detect damaged portions
  44. of a file and re-download them. If a hash of entire file is
  45. provided, hash check is only done when file has been already
  46. download. This is determined by file length. If hash check fails,
  47. file is re-downloaded from scratch. If both piece hashes and a hash
  48. of entire file are provided, only piece hashes are used. Default:
  49. ``false``
  50. .. option:: -c, --continue[=true|false]
  51. Continue downloading a partially downloaded file.
  52. Use this option to resume a download started by a web browser or another
  53. program which downloads files sequentially from the beginning.
  54. Currently this option is only applicable to HTTP(S)/FTP downloads.
  55. .. option:: -h, --help[=<TAG>|<KEYWORD>]
  56. The help messages are classified with tags. A tag starts with
  57. ``#``. For example, type ``--help=#http`` to get the usage for the
  58. options tagged with ``#http``. If non-tag word is given, print the
  59. usage for the options whose name includes that word. Available
  60. Values: ``#basic``, ``#advanced``, ``#http``, ``#https``, ``#ftp``,
  61. ``#metalink``, ``#bittorrent``, ``#cookie``, ``#hook``, ``#file``, ``#rpc``,
  62. ``#checksum``, ``#experimental``, ``#deprecated``, ``#help``, ``#all``
  63. Default: ``#basic``
  64. HTTP/FTP Options
  65. ~~~~~~~~~~~~~~~~
  66. .. option:: --all-proxy=<PROXY>
  67. Use this proxy server for all protocols. To erase previously
  68. defined proxy, use "". You can override this setting and specify a
  69. proxy server for a particular protocol using :option:`--http-proxy`,
  70. :option:`--https-proxy` and :option:`--ftp-proxy` options. This affects all URIs.
  71. The format of PROXY is ``[http://][USER:PASSWORD@]HOST[:PORT]``.
  72. See also `ENVIRONMENT`_ section.
  73. .. note::
  74. If user and password are embedded in proxy URI and they are also
  75. specified by *--{http,https,ftp,all}-proxy-{user,passwd}* options,
  76. those appeared later have precedence. For example, you have
  77. ``http-proxy-user=myname``, ``http-proxy-passwd=mypass`` in aria2.conf and
  78. you specify ``--http-proxy="http://proxy"`` in command-line, then you get
  79. HTTP proxy ``http://proxy`` with user ``myname`` and password
  80. ``mypass``.
  81. Another example: if you specified in command-line
  82. ``--http-proxy="http://user:pass@proxy" --http-proxy-user="myname"
  83. --http-proxy-passwd="mypass"``, then you will get HTTP proxy
  84. ``http://proxy`` with user ``myname`` and password ``mypass``.
  85. One more example: if you specified in command-line ``--http-proxy-user="myname"
  86. --http-proxy-passwd="mypass" --http-proxy="http://user:pass@proxy"``,
  87. then you get HTTP proxy ``http://proxy`` with user ``user`` and password
  88. ``pass``.
  89. .. option:: --all-proxy-passwd=<PASSWD>
  90. Set password for :option:`--all-proxy` option.
  91. .. option:: --all-proxy-user=<USER>
  92. Set user for :option:`--all-proxy` option.
  93. .. option:: --checksum=<TYPE>=<DIGEST>
  94. Set checksum. TYPE is hash type. The supported hash type is listed
  95. in ``Hash Algorithms`` in ``aria2c -v``. DIGEST is hex digest. For
  96. example, setting sha-1 digest looks like this:
  97. ``sha-1=0192ba11326fe2298c8cb4de616f4d4140213838`` This option applies
  98. only to HTTP(S)/FTP downloads.
  99. .. option:: --connect-timeout=<SEC>
  100. Set the connect timeout in seconds to establish connection to
  101. HTTP/FTP/proxy server. After the connection is established, this
  102. option makes no effect and :option:`--timeout <-t>` option is used instead.
  103. Default: ``60``
  104. .. option:: --dry-run[=true|false]
  105. If ``true`` is given, aria2 just checks whether the remote file is
  106. available and doesn't download data. This option has effect on
  107. HTTP/FTP download. BitTorrent downloads are canceled if ``true`` is
  108. specified. Default: ``false``
  109. .. option:: --lowest-speed-limit=<SPEED>
  110. Close connection if download speed is lower than or equal to this
  111. value(bytes per sec).
  112. ``0`` means aria2 does not have a lowest speed limit.
  113. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  114. This option does not affect BitTorrent downloads.
  115. Default: ``0``
  116. .. option:: -x, --max-connection-per-server=<NUM>
  117. The maximum number of connections to one server for each download.
  118. Default: ``1``
  119. .. option:: --max-file-not-found=<NUM>
  120. If aria2 receives "file not found" status from the remote HTTP/FTP
  121. servers NUM times without getting a single byte, then force the
  122. download to fail. Specify ``0`` to disable this option. This options is
  123. effective only when using HTTP/FTP servers.
  124. Default: ``0``
  125. .. option:: -m, --max-tries=<N>
  126. Set number of tries. ``0`` means unlimited.
  127. See also :option:`--retry-wait`.
  128. Default: ``5``
  129. .. option:: -k, --min-split-size=<SIZE>
  130. aria2 does not split less than 2*SIZE byte range. For example,
  131. let's consider downloading 20MiB file. If SIZE is 10M, aria2 can
  132. split file into 2 range [0-10MiB) and [10MiB-20MiB) and download it
  133. using 2 sources(if :option:`--split <-s>` >= 2, of course). If SIZE is 15M,
  134. since 2*15M > 20MiB, aria2 does not split file and download it using
  135. 1 source. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  136. Possible Values: ``1M`` -``1024M`` Default: ``20M``
  137. .. option:: -n, --no-netrc[=true|false]
  138. Disables netrc support. netrc support is enabled by default.
  139. .. note::
  140. netrc file is only read at the startup if
  141. :option:`--no-netrc <-n>` is ``false``.
  142. So if :option:`--no-netrc <-n>` is ``true`` at the startup,
  143. no netrc is available throughout the session.
  144. You cannot get netrc enabled even if you send
  145. :option:`--no-netrc=false <-n>` using
  146. :func:`aria2.changeGlobalOption`.
  147. .. option:: --no-proxy=<DOMAINS>
  148. Specify comma separated hostnames, domains and network address with
  149. or without CIDR block where proxy should not be used.
  150. .. note::
  151. For network address with CIDR block, both IPv4 and IPv6 addresses work. Current
  152. implementation does not resolve hostname in URI to compare network
  153. address specified in :option:`--no-proxy`. So it is only effecive if URI has
  154. numeric IP addresses.
  155. .. option:: -o, --out=<FILE>
  156. The file name of the downloaded file. When :option:`--force-sequential <-Z>` option is used, this
  157. option is ignored.
  158. .. note::
  159. In Metalink or BitTorrent download you cannot specify file name.
  160. The file name specified here is only used when the URIs fed to aria2
  161. are done by command line without :option:`--input-file <-i>`, :option:`--force-sequential <-Z>` option. For example:
  162. .. code-block:: console
  163. $ aria2c -o myfile.zip "http://mirror1/file.zip" "http://mirror2/file.zip"
  164. .. option:: --proxy-method=<METHOD>
  165. Set the method to use in proxy request. METHOD is either ``get`` or
  166. ``tunnel``. HTTPS downloads always use ``tunnel`` regardless of this
  167. option.
  168. Default: ``get``
  169. .. option:: -R, --remote-time[=true|false]
  170. Retrieve timestamp of the remote file from the remote HTTP/FTP
  171. server and if it is available, apply it to the local file.
  172. Default: ``false``
  173. .. option:: --reuse-uri[=true|false]
  174. Reuse already used URIs if no unused URIs are left.
  175. Default: ``true``
  176. .. option:: --retry-wait=<SEC>
  177. Set the seconds to wait between retries. With SEC > 0, aria2 will
  178. retry download when the HTTP server returns 503 response. Default:
  179. ``0``
  180. .. option:: --server-stat-of=<FILE>
  181. Specify the filename to which performance profile of the servers is
  182. saved. You can load saved data using :option:`--server-stat-if` option. See
  183. `Server Performance Profile`_
  184. subsection below for file format.
  185. .. option:: --server-stat-if=<FILE>
  186. Specify the filename to load performance profile of the servers. The
  187. loaded data will be used in some URI selector such as ``feedback``.
  188. See also :option:`--uri-selector` option. See
  189. `Server Performance Profile`_
  190. subsection below for file format.
  191. .. option:: --server-stat-timeout=<SEC>
  192. Specifies timeout in seconds to invalidate performance profile of
  193. the servers since the last contact to them.
  194. Default: ``86400`` (24hours)
  195. .. option:: -s, --split=<N>
  196. Download a file using N connections. If more than N URIs are given,
  197. first N URIs are used and remaining URIs are used for backup. If
  198. less than N URIs are given, those URIs are used more than once so
  199. that N connections total are made simultaneously. The number of
  200. connections to the same host is restricted by
  201. :option:`--max-connection-per-server <-x>` option.
  202. See also :option:`--min-split-size <-k>` option.
  203. Default: ``5``
  204. .. note::
  205. Some Metalinks regulate the number of servers to connect. aria2
  206. strictly respects them. This means that if Metalink defines the
  207. maxconnections attribute lower than N, then aria2 uses the
  208. value of maxconnections attribute instead of N.
  209. .. option:: --stream-piece-selector=<SELECTOR>
  210. Specify piece selection algorithm used in HTTP/FTP download. Piece
  211. means fixed length segment which is downloaded in parallel in
  212. segmented download. If ``default`` is given, aria2 selects piece so
  213. that it reduces the number of establishing connection. This is
  214. reasonable default behaviour because establishing connection is an
  215. expensive operation. If ``inorder`` is given, aria2 selects piece
  216. which has minimum index. Index=0 means first of the file. This will
  217. be useful to view movie while downloading it.
  218. :option:`--enable-http-pipelining` option may
  219. be useful to reduce reconnection overhead. Please note that aria2
  220. honors
  221. :option:`--min-split-size <-k>` option,
  222. so it will be necessary to specify a reasonable value to
  223. :option:`--min-split-size <-k>` option.
  224. If ``geom`` is given, at the beginning aria2 selects piece which has
  225. minimum index like ``inorder``, but it exponentially increasingly
  226. keeps space from previously selected piece. This will reduce the
  227. number of establishing connection and at the same time it will
  228. download the beginning part of the file first. This will be useful
  229. to view movie while downloading it.
  230. Default: ``default``
  231. .. option:: -t, --timeout=<SEC>
  232. Set timeout in seconds.
  233. Default: ``60``
  234. .. option:: --uri-selector=<SELECTOR>
  235. Specify URI selection algorithm. The possible values are ``inorder``,
  236. ``feedback`` and ``adaptive``. If ``inorder`` is given, URI is tried in
  237. the order appeared in the URI list. If ``feedback`` is given, aria2
  238. uses download speed observed in the previous downloads and choose
  239. fastest server in the URI list. This also effectively skips dead
  240. mirrors. The observed download speed is a part of performance
  241. profile of servers mentioned in :option:`--server-stat-of` and
  242. :option:`--server-stat-if` options. If ``adaptive`` is given, selects one of
  243. the best mirrors for the first and reserved connections. For
  244. supplementary ones, it returns mirrors which has not been tested
  245. yet, and if each of them has already been tested, returns mirrors
  246. which has to be tested again. Otherwise, it doesn't select anymore
  247. mirrors. Like ``feedback``, it uses a performance profile of servers.
  248. Default: ``feedback``
  249. HTTP Specific Options
  250. ~~~~~~~~~~~~~~~~~~~~~
  251. .. option:: --ca-certificate=<FILE>
  252. Use the certificate authorities in FILE to verify the peers.
  253. The certificate file must be in PEM format and can contain multiple CA
  254. certificates.
  255. Use :option:`--check-certificate` option to enable verification.
  256. .. note::
  257. If you build with OpenSSL or the recent version of GnuTLS which
  258. has ``gnutls_certificate_set_x509_system_trust()`` function and
  259. the library is properly configured to locate the system-wide CA
  260. certificates store, aria2 will automatically load those
  261. certificates at the startup.
  262. .. option:: --certificate=<FILE>
  263. Use the client certificate in FILE.
  264. The certificate must be in PEM format.
  265. You may use :option:`--private-key` option to specify the private key.
  266. .. option:: --check-certificate[=true|false]
  267. Verify the peer using certificates specified in :option:`--ca-certificate` option.
  268. Default: ``true``
  269. .. option:: --http-accept-gzip[=true|false]
  270. Send ``Accept: deflate, gzip`` request header and inflate response if
  271. remote server responds with ``Content-Encoding: gzip`` or
  272. ``Content-Encoding: deflate``. Default: ``false``
  273. .. note::
  274. Some server responds with ``Content-Encoding: gzip`` for files which
  275. itself is gzipped file. aria2 inflates them anyway because of the
  276. response header.
  277. .. option:: --http-auth-challenge[=true|false]
  278. Send HTTP authorization header only when it is requested by the
  279. server. If ``false`` is set, then authorization header is always sent
  280. to the server. There is an exception: if username and password are
  281. embedded in URI, authorization header is always sent to the server
  282. regardless of this option. Default: ``false``
  283. .. option:: --http-no-cache[=true|false]
  284. Send ``Cache-Control: no-cache`` and ``Pragma: no-cache`` header to avoid
  285. cached content. If ``false`` is given, these headers are not sent
  286. and you can add Cache-Control header with a directive you like
  287. using :option:`--header` option. Default: ``false``
  288. .. option:: --http-user=<USER>
  289. Set HTTP user. This affects all URIs.
  290. .. option:: --http-passwd=<PASSWD>
  291. Set HTTP password. This affects all URIs.
  292. .. option:: --http-proxy=<PROXY>
  293. Use this proxy server for HTTP. To erase previously defined proxy,
  294. use "". See also :option:`--all-proxy` option. This affects all URIs. The
  295. format of PROXY is ``[http://][USER:PASSWORD@]HOST[:PORT]``
  296. .. option:: --http-proxy-passwd=<PASSWD>
  297. Set password for :option:`--http-proxy` option.
  298. .. option:: --http-proxy-user=<USER>
  299. Set user for :option:`--http-proxy` option.
  300. .. option:: --https-proxy=<PROXY>
  301. Use this proxy server for HTTPS. To erase previously defined proxy,
  302. use "". See also :option:`--all-proxy` option. This affects all URIs. The
  303. format of PROXY is ``[http://][USER:PASSWORD@]HOST[:PORT]``
  304. .. option:: --https-proxy-passwd=<PASSWD>
  305. Set password for :option:`--https-proxy` option.
  306. .. option:: --https-proxy-user=<USER>
  307. Set user for :option:`--https-proxy` option.
  308. .. option:: --private-key=<FILE>
  309. Use the private key in FILE.
  310. The private key must be decrypted and in PEM format.
  311. The behavior when encrypted one is given is undefined.
  312. See also :option:`--certificate` option.
  313. .. option:: --referer=<REFERER>
  314. Set Referer. This affects all URIs.
  315. .. option:: --enable-http-keep-alive[=true|false]
  316. Enable HTTP/1.1 persistent connection.
  317. Default: ``true``
  318. .. option:: --enable-http-pipelining[=true|false]
  319. Enable HTTP/1.1 pipelining.
  320. Default: ``false``
  321. .. note::
  322. In performance perspective, there is usually no advantage to enable
  323. this option.
  324. .. option:: --header=<HEADER>
  325. Append HEADER to HTTP request header.
  326. You can use this option repeatedly to specify more than one header:
  327. .. code-block:: console
  328. $ aria2c --header="X-A: b78" --header="X-B: 9J1" "http://host/file"
  329. .. option:: --load-cookies=<FILE>
  330. Load Cookies from FILE using the Firefox3 format (SQLite3),
  331. Chromium/Google Chrome (SQLite3) and the
  332. Mozilla/Firefox(1.x/2.x)/Netscape format.
  333. .. note::
  334. If aria2 is built without libsqlite3, then it doesn't support Firefox3
  335. and Chromium/Google Chrome cookie format.
  336. .. option:: --save-cookies=<FILE>
  337. Save Cookies to FILE in Mozilla/Firefox(1.x/2.x)/ Netscape
  338. format. If FILE already exists, it is overwritten. Session Cookies
  339. are also saved and their expiry values are treated as 0. Possible
  340. Values: ``/path/to/file``
  341. .. option:: --use-head[=true|false]
  342. Use HEAD method for the first request to the HTTP server.
  343. Default: ``false``
  344. .. option:: -U, --user-agent=<USER_AGENT>
  345. Set user agent for HTTP(S) downloads.
  346. Default: ``aria2/$VERSION``, $VERSION is replaced by package version.
  347. FTP Specific Options
  348. ~~~~~~~~~~~~~~~~~~~~
  349. .. option:: --ftp-user=<USER>
  350. Set FTP user. This affects all URIs.
  351. Default: ``anonymous``
  352. .. option:: --ftp-passwd=<PASSWD>
  353. Set FTP password. This affects all URIs.
  354. If user name is embedded but password is missing in URI, aria2 tries
  355. to resolve password using .netrc. If password is found in .netrc,
  356. then use it as password. If not, use the password specified in this
  357. option.
  358. Default: ``ARIA2USER@``
  359. .. option:: -p, --ftp-pasv[=true|false]
  360. Use the passive mode in FTP.
  361. If ``false`` is given, the active mode will be used.
  362. Default: ``true``
  363. .. option:: --ftp-proxy=<PROXY>
  364. Use this proxy server for FTP. To erase previously defined proxy,
  365. use "". See also :option:`--all-proxy` option. This affects all URIs. The
  366. format of PROXY is ``[http://][USER:PASSWORD@]HOST[:PORT]``
  367. .. option:: --ftp-proxy-passwd=<PASSWD>
  368. Set password for :option:`--ftp-proxy` option.
  369. .. option:: --ftp-proxy-user=<USER>
  370. Set user for :option:`--ftp-proxy` option.
  371. .. option:: --ftp-type=<TYPE>
  372. Set FTP transfer type. TYPE is either ``binary`` or ``ascii``.
  373. Default: ``binary``
  374. .. option:: --ftp-reuse-connection[=true|false]
  375. Reuse connection in FTP.
  376. Default: ``true``
  377. BitTorrent/Metalink Options
  378. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  379. .. option:: --select-file=<INDEX>...
  380. Set file to download by specifying its index.
  381. You can find the file index using the :option:`--show-files <-S>` option.
  382. Multiple indexes can be specified by using ``,``, for example: ``3,6``.
  383. You can also use ``-`` to specify a range: ``1-5``.
  384. ``,`` and ``-`` can be used together: ``1-5,8,9``.
  385. When used with the -M option, index may vary depending on the query
  386. (see *--metalink-\** options).
  387. .. note::
  388. In multi file torrent, the adjacent files specified by this option may
  389. also be downloaded. This is by design, not a bug.
  390. A single piece may include several files or part of files, and aria2
  391. writes the piece to the appropriate files.
  392. .. option:: -S, --show-files[=true|false]
  393. Print file listing of ".torrent", ".meta4" and ".metalink" file and exit.
  394. In case of ".torrent" file, additional information
  395. (infohash, piece length, etc) is also printed.
  396. BitTorrent Specific Options
  397. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  398. .. option:: --bt-enable-lpd[=true|false]
  399. Enable Local Peer Discovery. If a private flag is set in a torrent,
  400. aria2 doesn't use this feature for that download even if ``true`` is
  401. given. Default: ``false``
  402. .. option:: --bt-exclude-tracker=<URI>[,...]
  403. Comma separated list of BitTorrent tracker's announce URI to
  404. remove. You can use special value ``*`` which matches all URIs, thus
  405. removes all announce URIs. When specifying ``*`` in shell
  406. command-line, don't forget to escape or quote it. See also
  407. :option:`--bt-tracker` option.
  408. .. option:: --bt-external-ip=<IPADDRESS>
  409. Specify the external IP address to report to a BitTorrent
  410. tracker. Although this function is named ``external``, it can accept
  411. any kind of IP addresses. IPADDRESS must be a numeric IP address.
  412. .. option:: --bt-hash-check-seed[=true|false]
  413. If ``true`` is given, after hash check using :option:`--check-integrity <-V>` option and
  414. file is complete, continue to seed file. If you want to check file
  415. and download it only when it is damaged or incomplete, set this
  416. option to ``false``. This option has effect only on BitTorrent download.
  417. Default: ``true``
  418. .. option:: --bt-lpd-interface=<INTERFACE>
  419. Use given interface for Local Peer Discovery. If this option is not
  420. specified, the default interface is chosen. You can specify
  421. interface name and IP address. Possible Values: interface, IP
  422. addres
  423. .. option:: --bt-max-open-files=<NUM>
  424. Specify maximum number of files to open in each BitTorrent download.
  425. Default: ``100``
  426. .. option:: --bt-max-peers=<NUM>
  427. Specify the maximum number of peers per torrent. ``0`` means
  428. unlimited. See also :option:`--bt-request-peer-speed-limit` option.
  429. Default: ``55``
  430. .. option:: --bt-metadata-only[=true|false]
  431. Download metadata only. The file(s) described in metadata will not
  432. be downloaded. This option has effect only when BitTorrent Magnet
  433. URI is used. See also :option:`--bt-save-metadata` option. Default: ``false``
  434. .. option:: --bt-min-crypto-level=plain|arc4
  435. Set minimum level of encryption method.
  436. If several encryption methods are provided by a peer, aria2 chooses the lowest
  437. one which satisfies the given level.
  438. Default: ``plain``
  439. .. option:: --bt-prioritize-piece=head[=<SIZE>],tail[=<SIZE>]
  440. Try to download first and last pieces of each file first. This is
  441. useful for previewing files. The argument can contain 2 keywords:
  442. ``head`` and ``tail``. To include both keywords, they must be separated
  443. by comma. These keywords can take one parameter, SIZE. For example,
  444. if ``head=<SIZE>`` is specified, pieces in the range of first SIZE bytes
  445. of each file get higher priority. ``tail=<SIZE>`` means the range of
  446. last SIZE bytes of each file. SIZE can include ``K`` or ``M`` (1K = 1024,
  447. 1M = 1024K). If SIZE is omitted, SIZE=1M is used.
  448. .. option:: --bt-remove-unselected-file[=true|false]
  449. Removes the unselected files when download is completed in
  450. BitTorrent. To select files, use
  451. :option:`--select-file` option. If it is
  452. not used, all files are assumed to be selected. Please use this
  453. option with care because it will actually remove files from your
  454. disk.
  455. Default: ``false``
  456. .. option:: --bt-require-crypto[=true|false]
  457. If true is given, aria2 doesn't accept and establish connection with legacy
  458. BitTorrent handshake(\19BitTorrent protocol).
  459. Thus aria2 always uses Obfuscation handshake.
  460. Default: ``false``
  461. .. option:: --bt-request-peer-speed-limit=<SPEED>
  462. If the whole download speed of every torrent is lower than SPEED,
  463. aria2 temporarily increases the number of peers to try for more
  464. download speed. Configuring this option with your preferred download
  465. speed can increase your download speed in some cases.
  466. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  467. Default: ``50K``
  468. .. option:: --bt-save-metadata[=true|false]
  469. Save metadata as ".torrent" file. This option has effect only when
  470. BitTorrent Magnet URI is used. The filename is hex encoded info
  471. hash with suffix ".torrent". The directory to be saved is the same
  472. directory where download file is saved. If the same file already
  473. exists, metadata is not saved. See also :option:`--bt-metadata-only`
  474. option. Default: ``false``
  475. .. option:: --bt-seed-unverified[=true|false]
  476. Seed previously downloaded files without verifying piece hashes.
  477. Default: ``false``
  478. .. option:: --bt-stop-timeout=<SEC>
  479. Stop BitTorrent download if download speed is 0 in consecutive SEC
  480. seconds. If ``0`` is given, this feature is disabled. Default: ``0``
  481. .. option:: --bt-tracker=<URI>[,...]
  482. Comma separated list of additional BitTorrent tracker's announce
  483. URI. These URIs are not affected by :option:`--bt-exclude-tracker` option
  484. because they are added after URIs in :option:`--bt-exclude-tracker` option are
  485. removed.
  486. .. option:: --bt-tracker-connect-timeout=<SEC>
  487. Set the connect timeout in seconds to establish connection to
  488. tracker. After the connection is established, this option makes no
  489. effect and :option:`--bt-tracker-timeout` option is used instead. Default:
  490. ``60``
  491. .. option:: --bt-tracker-interval=<SEC>
  492. Set the interval in seconds between tracker requests. This
  493. completely overrides interval value and aria2 just uses this value
  494. and ignores the min interval and interval value in the response of
  495. tracker. If ``0`` is set, aria2 determines interval based on the
  496. response of tracker and the download progress. Default: ``0``
  497. .. option:: --bt-tracker-timeout=<SEC>
  498. Set timeout in seconds. Default: ``60``
  499. .. option:: --dht-entry-point=<HOST>:<PORT>
  500. Set host and port as an entry point to IPv4 DHT network.
  501. .. option:: --dht-entry-point6=<HOST>:<PORT>
  502. Set host and port as an entry point to IPv6 DHT network.
  503. .. option:: --dht-file-path=<PATH>
  504. Change the IPv4 DHT routing table file to PATH.
  505. Default: ``$HOME/.aria2/dht.dat``
  506. .. option:: --dht-file-path6=<PATH>
  507. Change the IPv6 DHT routing table file to PATH.
  508. Default: ``$HOME/.aria2/dht6.dat``
  509. .. option:: --dht-listen-addr6=<ADDR>
  510. Specify address to bind socket for IPv6 DHT. It should be a global
  511. unicast IPv6 address of the host.
  512. .. option:: --dht-listen-port=<PORT>...
  513. Set UDP listening port for both IPv4 and IPv6 DHT.
  514. Multiple ports can be specified by using ``,``, for example: ``6881,6885``.
  515. You can also use ``-`` to specify a range: ``6881-6999``. ``,`` and ``-`` can be used
  516. together.
  517. Default: ``6881-6999``
  518. .. note::
  519. Make sure that the specified ports are open for incoming UDP traffic.
  520. .. option:: --dht-message-timeout=<SEC>
  521. Set timeout in seconds. Default: ``10``
  522. .. option:: --enable-dht[=true|false]
  523. Enable IPv4 DHT functionality. If a private flag is set in a
  524. torrent, aria2 doesn't use DHT for that download even if ``true`` is
  525. given. Default: ``true``
  526. .. option:: --enable-dht6[=true|false]
  527. Enable IPv6 DHT functionality. If a private flag is set in a
  528. torrent, aria2 doesn't use DHT for that download even if ``true`` is
  529. given. Use :option:`--dht-listen-port` option to specify port number to
  530. listen on. See also :option:`--dht-listen-addr6` option.
  531. .. option:: --enable-peer-exchange[=true|false]
  532. Enable Peer Exchange extension. If a private flag is set in a torrent, this
  533. feature is disabled for that download even if ``true`` is given.
  534. Default: ``true``
  535. .. option:: --follow-torrent=true|false|mem
  536. If ``true`` or ``mem`` is specified, when a file whose suffix is ``.torrent`` or content
  537. type is ``application/x-bittorrent`` is downloaded, aria2 parses it as a torrent
  538. file and downloads files mentioned in it.
  539. If ``mem`` is specified, a torrent file is not written to the disk, but is just
  540. kept in memory.
  541. If ``false`` is specified, the action mentioned above is not taken.
  542. Default: ``true``
  543. .. option:: -O, --index-out=<INDEX>=<PATH>
  544. Set file path for file with index=INDEX. You can find the file index
  545. using the :option:`--show-files <-S>` option. PATH is a relative path to the
  546. path specified in :option:`--dir <-d>` option. You can use this option multiple
  547. times. Using this option, you can specify the output filenames of
  548. BitTorrent downloads.
  549. .. option:: --listen-port=<PORT>...
  550. Set TCP port number for BitTorrent downloads.
  551. Multiple ports can be specified by using ``,``, for example: ``6881,6885``.
  552. You can also use ``-`` to specify a range: ``6881-6999``.
  553. ``,`` and ``-`` can be used together: ``6881-6889,6999``.
  554. Default: ``6881-6999``
  555. .. note::
  556. Make sure that the specified ports are open for incoming TCP traffic.
  557. .. option:: --max-overall-upload-limit=<SPEED>
  558. Set max overall upload speed in bytes/sec.
  559. ``0`` means unrestricted.
  560. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  561. To limit the upload speed per torrent, use :option:`--max-upload-limit <-u>` option.
  562. Default: ``0``
  563. .. option:: -u, --max-upload-limit=<SPEED>
  564. Set max upload speed per each torrent in bytes/sec.
  565. ``0`` means unrestricted.
  566. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  567. To limit the overall upload speed, use :option:`--max-overall-upload-limit` option.
  568. Default: ``0``
  569. .. option:: --peer-id-prefix=<PEER_ID_PREFIX>
  570. Specify the prefix of peer ID. The peer ID in
  571. BitTorrent is 20 byte length. If more than 20
  572. bytes are specified, only first 20 bytes are
  573. used. If less than 20 bytes are specified, random
  574. byte data are added to make its length 20 bytes.
  575. Default: ``aria2/$VERSION-``, $VERSION is replaced by package version.
  576. .. option:: --seed-ratio=<RATIO>
  577. Specify share ratio. Seed completed torrents until share ratio reaches
  578. RATIO.
  579. You are strongly encouraged to specify equals or more than ``1.0`` here.
  580. Specify ``0.0`` if you intend to do seeding regardless of share ratio.
  581. If :option:`--seed-time` option is specified along with this option, seeding ends when
  582. at least one of the conditions is satisfied.
  583. Default: ``1.0``
  584. .. option:: --seed-time=<MINUTES>
  585. Specify seeding time in minutes. Also see the :option:`--seed-ratio` option.
  586. .. note::
  587. Specifying :option:`--seed-time=0 <--seed-time>` disables seeding after download completed.
  588. .. option:: -T, --torrent-file=<TORRENT_FILE>
  589. The path to the ".torrent" file. You are not required to use this
  590. option because you can specify ".torrent" files without :option:`--torrent-file <-T>`.
  591. Metalink Specific Options
  592. ~~~~~~~~~~~~~~~~~~~~~~~~~
  593. .. option:: --follow-metalink=true|false|mem
  594. If ``true`` or ``mem`` is specified, when a file whose suffix is ``.meta4`` or ``.metalink`` or content
  595. type of ``application/metalink4+xml`` or ``application/metalink+xml`` is downloaded, aria2 parses it as a metalink
  596. file and downloads files mentioned in it.
  597. If ``mem`` is specified, a metalink file is not written to the disk, but is just
  598. kept in memory.
  599. If ``false`` is specified, the action mentioned above is not taken.
  600. Default: ``true``
  601. .. option:: --metalink-base-uri=<URI>
  602. Specify base URI to resolve relative URI in metalink:url and
  603. metalink:metaurl element in a metalink file stored in local disk. If
  604. URI points to a directory, URI must end with ``/``.
  605. .. option:: -M, --metalink-file=<METALINK_FILE>
  606. The file path to ".meta4" and ".metalink" file. Reads input from stdin when ``-`` is
  607. specified. You are not required to use this option because you can
  608. specify ".metalink" files without :option:`--metalink-file <-M>`.
  609. .. option:: --metalink-language=<LANGUAGE>
  610. The language of the file to download.
  611. .. option:: --metalink-location=<LOCATION>[,...]
  612. The location of the preferred server.
  613. A comma-delimited list of locations is acceptable, for example, ``jp,us``.
  614. .. option:: --metalink-os=<OS>
  615. The operating system of the file to download.
  616. .. option:: --metalink-version=<VERSION>
  617. The version of the file to download.
  618. .. option:: --metalink-preferred-protocol=<PROTO>
  619. Specify preferred protocol.
  620. The possible values are ``http``, ``https``, ``ftp`` and ``none``.
  621. Specify ``none`` to disable this feature.
  622. Default: ``none``
  623. .. option:: --metalink-enable-unique-protocol[=true|false]
  624. If ``true`` is given and several protocols are available for a mirror in a
  625. metalink file, aria2 uses one of them.
  626. Use :option:`--metalink-preferred-protocol` option to specify the preference of
  627. protocol.
  628. Default: ``true``
  629. RPC Options
  630. ~~~~~~~~~~~
  631. .. option:: --enable-rpc[=true|false]
  632. Enable JSON-RPC/XML-RPC server. It is strongly recommended to set username
  633. and password using :option:`--rpc-user` and :option:`--rpc-passwd`
  634. option. See also :option:`--rpc-listen-port` option. Default: ``false``
  635. .. option:: --pause[=true|false]
  636. Pause download after added. This option is effective only when
  637. :option:`--enable-rpc=true <--enable-rpc>` is given.
  638. Default: ``false``
  639. .. option:: --rpc-allow-origin-all[=true|false]
  640. Add Access-Control-Allow-Origin header field with value ``*`` to the
  641. RPC response.
  642. Default: ``false``
  643. .. option:: --rpc-certificate=<FILE>
  644. Use the certificate in FILE for RPC server. The certificate must be
  645. in PEM format. Use :option:`--rpc-private-key` option to specify the
  646. private key. Use :option:`--rpc-secure` option to enable encryption.
  647. .. option:: --rpc-listen-all[=true|false]
  648. Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false
  649. is given, listen only on local loopback interface. Default: ``false``
  650. .. option:: --rpc-listen-port=<PORT>
  651. Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible
  652. Values: ``1024`` -``65535`` Default: ``6800``
  653. .. option:: --rpc-max-request-size=<SIZE>
  654. Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is
  655. more than SIZE bytes, it drops connection. Default: ``2M``
  656. .. option:: --rpc-passwd=<PASSWD>
  657. Set JSON-RPC/XML-RPC password.
  658. .. option:: --rpc-private-key=<FILE>
  659. Use the private key in FILE for RPC server. The private key must be
  660. decrypted and in PEM format. Use :option:`--rpc-secure` option to
  661. enable encryption. See also :option:`--rpc-certificate` option.
  662. .. option:: --rpc-save-upload-metadata[=true|false]
  663. Save the uploaded torrent or metalink metadata in the directory
  664. specified by :option:`--dir` option. The filename consists of SHA-1
  665. hash hex string of metadata plus extension. For torrent, the
  666. extension is '.torrent'. For metalink, it is '.meta4'. If false is
  667. given to this option, the downloads added by
  668. :func:`aria2.addTorrent` or :func:`aria2.addMetalink` will not be
  669. saved by :option:`--save-session` option. Default: ``false``
  670. .. option:: --rpc-secure[=true|false]
  671. RPC transport will be encrypted by SSL/TLS. The RPC clients must
  672. use https scheme to access the server. For WebSocket client, use wss
  673. scheme. Use :option:`--rpc-certificate` and
  674. :option:`--rpc-private-key` options to specify the server
  675. certificate and private key.
  676. .. option:: --rpc-user=<USER>
  677. Set JSON-RPC/XML-RPC user.
  678. Advanced Options
  679. ~~~~~~~~~~~~~~~~
  680. .. option:: --allow-overwrite[=true|false]
  681. Restart download from scratch if the corresponding control file
  682. doesn't exist. See also :option:`--auto-file-renaming` option. Default:
  683. ``false``
  684. .. option:: --allow-piece-length-change[=true|false]
  685. If false is given, aria2 aborts download when a piece length is different
  686. from one in a control file.
  687. If true is given, you can proceed but some download progress will be lost.
  688. Default: ``false``
  689. .. option:: --always-resume[=true|false]
  690. Always resume download. If ``true`` is given, aria2 always tries to
  691. resume download and if resume is not possible, aborts download. If
  692. ``false`` is given, when all given URIs do not support resume or aria2
  693. encounters ``N`` URIs which does not support resume (``N`` is the value
  694. specified using :option:`--max-resume-failure-tries` option), aria2
  695. downloads file from scratch. See :option:`--max-resume-failure-tries`
  696. option. Default: ``true``
  697. .. option:: --async-dns[=true|false]
  698. Enable asynchronous DNS.
  699. Default: ``true``
  700. .. option:: --async-dns-server=<IPADDRESS>[,...]
  701. Comma separated list of DNS server address used in asynchronous DNS
  702. resolver. Usually asynchronous DNS resolver reads DNS server
  703. addresses from ``/etc/resolv.conf``. When this option is used, it uses
  704. DNS servers specified in this option instead of ones in
  705. ``/etc/resolv.conf``. You can specify both IPv4 and IPv6 address. This
  706. option is useful when the system does not have ``/etc/resolv.conf`` and
  707. user does not have the permission to create it.
  708. .. option:: --auto-file-renaming[=true|false]
  709. Rename file name if the same file already exists.
  710. This option works only in HTTP(S)/FTP download.
  711. The new file name has a dot and a number(1..9999) appended.
  712. Default: ``true``
  713. .. option:: --auto-save-interval=<SEC>
  714. Save a control file(\*.aria2) every SEC seconds.
  715. If ``0`` is given, a control file is not saved during download. aria2 saves a
  716. control file when it stops regardless of the value.
  717. The possible values are between ``0`` to ``600``.
  718. Default: ``60``
  719. .. option:: --conditional-get[=true|false]
  720. Download file only when the local file is older than remote
  721. file. This function only works with HTTP(S) downloads only. It does
  722. not work if file size is specified in Metalink. It also ignores
  723. Content-Disposition header. If a control file exists, this option
  724. will be ignored. This function uses If-Modified-Since header to get
  725. only newer file conditionally. When getting modification time of
  726. local file, it uses user supplied filename(see :option:`--out <-o>` option) or
  727. filename part in URI if :option:`--out <-o>` is not specified.
  728. To overwrite existing file, :option:`--allow-overwrite` is required.
  729. Default: ``false``
  730. .. option:: --conf-path=<PATH>
  731. Change the configuration file path to PATH.
  732. Default: ``$HOME/.aria2/aria2.conf``
  733. .. option:: --console-log-level=<LEVEL>
  734. Set log level to output to console. LEVEL is either ``debug``,
  735. ``info``, ``notice``, ``warn`` or ``error``. Default: ``notice``
  736. .. option:: -D, --daemon[=true|false]
  737. Run as daemon. The current working directory will be changed to ``/``
  738. and standard input, standard output and standard error will be
  739. redirected to ``/dev/null``. Default: ``false``
  740. .. option:: --deferred-input[=true|false]
  741. If ``true`` is given, aria2 does not read all URIs and options from file
  742. specified by :option:`--input-file <-i>` option at startup,
  743. but it reads one by one when it
  744. needs later. This may reduce memory usage if input file contains a
  745. lot of URIs to download. If ``false`` is given, aria2 reads all URIs
  746. and options at startup.
  747. Default: ``false``
  748. .. option:: --disable-ipv6[=true|false]
  749. Disable IPv6. This is useful if you have to use broken DNS and want
  750. to avoid terribly slow AAAA record lookup. Default: ``false``
  751. .. option:: --disk-cache=<SIZE>
  752. Enable disk cache. If SIZE is ``0``, the disk cache is
  753. disabled. This feature caches the downloaded data in memory, which
  754. grows to at most SIZE bytes. The cache storage is created for aria2
  755. instance and shared by all downloads. The one advantage of the disk
  756. cache is reduce the disk I/O because the data are written in larger
  757. unit and it is reordered by the offset of the file. If hash
  758. checking is involved and the data are cached in memory, we don't
  759. need to read them from the disk. SIZE can include ``K`` or ``M``
  760. (1K = 1024, 1M = 1024K). Default: ``0``
  761. .. option:: --download-result=<OPT>
  762. This option changes the way ``Download Results`` is formatted. If OPT
  763. is ``default``, print GID, status, average download speed and
  764. path/URI. If multiple files are involved, path/URI of first
  765. requested file is printed and remaining ones are omitted. If OPT is
  766. ``full``, print GID, status, average download speed, percentage of
  767. progress and path/URI. The percentage of progress and path/URI are
  768. printed for each requested file in each row.
  769. Default: ``default``
  770. .. option:: --enable-async-dns6[=true|false]
  771. Enable IPv6 name resolution in asynchronous DNS resolver. This
  772. option will be ignored when :option:`--async-dns=false. <--async-dns>`
  773. Default: ``false``
  774. .. option:: --enable-mmap[=true|false]
  775. Map files into memory. This option may not work if the file space
  776. is not pre-allocated. See :option:`--file-allocation`.
  777. Default: ``false``
  778. .. option:: --event-poll=<POLL>
  779. Specify the method for polling events. The possible values are
  780. ``epoll``, ``kqueue``, ``port``, ``poll`` and ``select``. For each ``epoll``,
  781. ``kqueue``, ``port`` and ``poll``, it is available if system supports it.
  782. ``epoll`` is available on recent Linux. ``kqueue`` is available on
  783. various \*BSD systems including Mac OS X. ``port`` is available on Open
  784. Solaris. The default value may vary depending on the system you use.
  785. .. option:: --file-allocation=<METHOD>
  786. Specify file allocation method.
  787. ``none`` doesn't pre-allocate file space. ``prealloc`` pre-allocates file space
  788. before download begins. This may take some time depending on the size of the
  789. file.
  790. If you are using newer file systems such as ext4
  791. (with extents support), btrfs, xfs or NTFS(MinGW build only), ``falloc`` is
  792. your best choice. It allocates large(few GiB)
  793. files almost instantly. Don't use ``falloc`` with
  794. legacy file systems such as ext3 and FAT32 because it takes
  795. almost same time as ``prealloc`` and it blocks aria2
  796. entirely until allocation finishes. ``falloc`` may
  797. not be available if your system doesn't have
  798. :manpage:`posix_fallocate(3)` function.
  799. ``trunc`` uses :manpage:`ftruncate(2)` system call or
  800. platform-specific counterpart to truncate a file to a specified
  801. length.
  802. Possible Values: ``none``, ``prealloc``, ``trunc``, ``falloc``
  803. Default: ``prealloc``
  804. .. option:: --force-save[=true|false]
  805. Save download with :option:`--save-session <--save-session>` option
  806. even if the download is completed or removed. This may be useful to
  807. save BitTorrent seeding which is recognized as completed state.
  808. Default: ``false``
  809. .. option:: --gid=<GID>
  810. Set GID manually. aria2 identifies each download by the ID called
  811. GID. The GID must be hex string of 16 characters, thus [0-9a-zA-Z]
  812. are allowed and leading zeros must not be stripped. The GID all 0 is
  813. reserved and must not be used. The GID must be unique, otherwise
  814. error is reported and the download is not added. This option is
  815. useful when restoring the sessions saved using
  816. :option:`--save-session <--save-session>` option. If this option is
  817. not used, new GID is generated by aria2.
  818. .. option:: --hash-check-only[=true|false]
  819. If ``true`` is given, after hash check using
  820. :option:`--check-integrity <-V>` option,
  821. abort download whether or not download is complete.
  822. Default: ``false``
  823. .. option:: --human-readable[=true|false]
  824. Print sizes and speed in human readable format (e.g., 1.2Ki, 3.4Mi)
  825. in the console readout. Default: ``true``
  826. .. option:: --interface=<INTERFACE>
  827. Bind sockets to given interface. You can specify interface name, IP
  828. address and hostname.
  829. Possible Values: interface, IP address, hostname
  830. .. note::
  831. If an interface has multiple addresses, it is highly recommended to
  832. specify IP address explicitly. See also :option:`--disable-ipv6`. If your
  833. system doesn't have :manpage:`getifaddrs(3)`, this option doesn't accept interface
  834. name.
  835. .. option:: --max-download-result=<NUM>
  836. Set maximum number of download result kept in memory. The download
  837. results are completed/error/removed downloads. The download results
  838. are stored in FIFO queue and it can store at most NUM download
  839. results. When queue is full and new download result is created,
  840. oldest download result is removed from the front of the queue and
  841. new one is pushed to the back. Setting big number in this option may
  842. result high memory consumption after thousands of
  843. downloads. Specifying 0 means no download result is kept. Default:
  844. ``1000``
  845. .. option:: --max-resume-failure-tries=<N>
  846. When used with :option:`--always-resume=false, <--always-resume>` aria2 downloads file from
  847. scratch when aria2 detects N number of URIs that does not support
  848. resume. If N is ``0``, aria2 downloads file from scratch when all
  849. given URIs do not support resume. See :option:`--always-resume` option.
  850. Default: ``0``
  851. .. option:: --log-level=<LEVEL>
  852. Set log level to output.
  853. LEVEL is either ``debug``, ``info``, ``notice``, ``warn`` or ``error``.
  854. Default: ``debug``
  855. .. option:: --on-bt-download-complete=<COMMAND>
  856. For BitTorrent, a command specified in :option:`--on-download-complete` is
  857. called after download completed and seeding is over. On the other
  858. hand, this option set the command to be executed after download
  859. completed but before seeding.
  860. See `Event Hook`_ for more details about COMMAND.
  861. Possible Values: ``/path/to/command``
  862. .. option:: --on-download-complete=<COMMAND>
  863. Set the command to be executed after download completed. See
  864. See `Event Hook`_ for more details about COMMAND.
  865. See also :option:`--on-download-stop` option.
  866. Possible Values: ``/path/to/command``
  867. .. option:: --on-download-error=<COMMAND>
  868. Set the command to be executed after download aborted due to error.
  869. See `Event Hook`_ for more details about COMMAND.
  870. See also :option:`--on-download-stop` option. Possible Values:
  871. ``/path/to/command``
  872. .. option:: --on-download-pause=<COMMAND>
  873. Set the command to be executed after download was paused.
  874. See `Event Hook`_ for more details about COMMAND.
  875. Possible Values: ``/path/to/command``
  876. .. option:: --on-download-start=<COMMAND>
  877. Set the command to be executed after download got started.
  878. See `Event Hook`_ for more details about COMMAND.
  879. Possible Values: ``/path/to/command``
  880. .. option:: --on-download-stop=<COMMAND>
  881. Set the command to be executed after download stopped. You can override
  882. the command to be executed for particular download result using
  883. :option:`--on-download-complete` and :option:`--on-download-error`. If they are
  884. specified, command specified in this option is not executed.
  885. See `Event Hook`_ for more details about COMMAND.
  886. Possible Values: ``/path/to/command``
  887. .. option:: --piece-length=<LENGTH>
  888. Set a piece length for HTTP/FTP downloads. This is the boundary when
  889. aria2 splits a file. All splits occur at multiple of this
  890. length. This option will be ignored in BitTorrent downloads. It
  891. will be also ignored if Metalink file contains piece hashes.
  892. Default: ``1M``
  893. .. note::
  894. The possible usecase of :option:`--piece-length`
  895. option is change the request range in one HTTP pipelined request.
  896. To enable HTTP pipelining use
  897. :option:`--enable-http-pipelining`.
  898. .. option:: --show-console-readout[=true|false]
  899. Show console readout. Default: ``true``
  900. .. option:: --summary-interval=<SEC>
  901. Set interval in seconds to output download progress summary.
  902. Setting ``0`` suppresses the output.
  903. Default: ``60``
  904. .. note::
  905. In multi file torrent downloads, the files adjacent forward to the specified files
  906. are also allocated if they share the same piece.
  907. .. option:: -Z, --force-sequential[=true|false]
  908. Fetch URIs in the command-line sequentially and download each URI in a
  909. separate session, like the usual command-line download utilities.
  910. Default: ``false``
  911. .. option:: --max-overall-download-limit=<SPEED>
  912. Set max overall download speed in bytes/sec. ``0`` means
  913. unrestricted. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K). To
  914. limit the download speed per download, use :option:`--max-download-limit`
  915. option. Default: ``0``
  916. .. option:: --max-download-limit=<SPEED>
  917. Set max download speed per each download in bytes/sec. ``0`` means
  918. unrestricted. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K). To
  919. limit the overall download speed, use :option:`--max-overall-download-limit`
  920. option. Default: ``0``
  921. .. option:: --no-conf[=true|false]
  922. Disable loading aria2.conf file.
  923. .. option:: --no-file-allocation-limit=<SIZE>
  924. No file allocation is made for files whose size is smaller than SIZE.
  925. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  926. Default: ``5M``
  927. .. option:: -P, --parameterized-uri[=true|false]
  928. Enable parameterized URI support.
  929. You can specify set of parts: ``http://{sv1,sv2,sv3}/foo.iso``.
  930. Also you can specify numeric sequences with step counter:
  931. ``http://host/image[000-100:2].img``.
  932. A step counter can be omitted.
  933. If all URIs do not point to the same file, such as the second example above,
  934. -Z option is required.
  935. Default: ``false``
  936. .. option:: -q, --quiet[=true|false]
  937. Make aria2 quiet (no console output).
  938. Default: ``false``
  939. .. option:: --realtime-chunk-checksum[=true|false]
  940. Validate chunk of data by calculating checksum while downloading a file if
  941. chunk checksums are provided.
  942. Default: ``true``
  943. .. option:: --remove-control-file[=true|false]
  944. Remove control file before download. Using with
  945. :option:`--allow-overwrite=true, <--allow-overwrite>` download always starts from
  946. scratch. This will be useful for users behind proxy server which
  947. disables resume.
  948. .. option:: --save-session=<FILE>
  949. Save error/unfinished downloads to FILE on exit. You can pass this
  950. output file to aria2c with :option:`--input-file <-i>` option on
  951. restart. Please note that downloads added by
  952. :func:`aria2.addTorrent` and :func:`aria2.addMetalink` RPC method
  953. and whose metadata could not be saved as a file are not saved.
  954. Downloads removed using :func:`aria2.remove` and
  955. :func:`aria2.forceRemove` will not be saved. GID is also saved with
  956. :option:`gid <--gid>`, but there are some restrictions, see below.
  957. .. note::
  958. Normally, GID of the download itself is saved. But some downloads
  959. use metadata (e.g., BitTorrent and Metalink). In this case, there
  960. are some restrictions.
  961. 1. magnet URI, and followed by torrent download
  962. GID of BitTorrent metadata download is saved.
  963. 2. URI to torrent file, and followed by torrent download
  964. GID of torrent file download is saved.
  965. 3. URI to metalink file, and followed by file downloads described in metalink file
  966. GID of metalink file download is saved.
  967. 4. local torrent file
  968. GID of torrent download is saved.
  969. 5. local metalink file
  970. Any meaningful GID is not saved.
  971. .. option:: --stop=<SEC>
  972. Stop application after SEC seconds has passed.
  973. If ``0`` is given, this feature is disabled.
  974. Default: ``0``
  975. .. option:: --stop-with-process=<PID>
  976. Stop application when process PID is not running. This is useful if
  977. aria2 process is forked from a parent process. The parent process
  978. can fork aria2 with its own pid and when parent process exits for
  979. some reason, aria2 can detect it and shutdown itself.
  980. .. option:: --truncate-console-readout[=true|false]
  981. Truncate console readout to fit in a single line.
  982. Default: ``true``
  983. .. option:: -v, --version
  984. Print the version number, copyright and the configuration information and
  985. exit.
  986. Options That Take An Optional Argument
  987. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  988. The options that have its argument surrounded by square brackets([])
  989. take an optional argument. Usually omiting the argument is evaluated to ``true``.
  990. If you use short form of these options(such as ``-V``) and give
  991. an argument, then the option name and its argument should be concatenated(e.g.
  992. ``-Vfalse``). If any spaces are inserted between the option name and the argument,
  993. the argument will be treated as URI and usually this is not what you expect.
  994. URI, MAGNET, TORRENT_FILE, METALINK_FILE
  995. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  996. You can specify multiple URIs in command-line. Unless you specify
  997. :option:`--force-sequential <-Z>` option, all URIs must point to the same file or downloading will
  998. fail.
  999. You can specify arbitrary number of BitTorrent Magnet URI. Please note
  1000. that they are always treated as a separate download. Both hex encoded
  1001. 40 characters Info Hash and Base32 encoded 32 characters Info Hash are
  1002. supported. The multiple ``tr`` parameters are supported. Because
  1003. BitTorrent Magnet URI is likely to contain ``&`` character, it is highly
  1004. recommended to always quote URI with single(``'``) or double(``"``) quotation.
  1005. It is strongly recommended to enable DHT especially when ``tr``
  1006. parameter is missing. See http://www.bittorrent.org/beps/bep_0009.html
  1007. for more details about BitTorrent Magnet URI.
  1008. You can also specify arbitrary number of torrent files and Metalink
  1009. documents stored on a local drive. Please note that they are always
  1010. treated as a separate download. Both Metalink4 and Metalink version
  1011. 3.0 are supported.
  1012. You can specify both torrent file with -T option and URIs. By doing
  1013. this, you can download a file from both torrent swarm and HTTP(S)/FTP
  1014. server at the same time, while the data from HTTP(S)/FTP are uploaded
  1015. to the torrent swarm. For single file torrents, URI can be a complete
  1016. URI pointing to the resource or if URI ends with /, name in torrent
  1017. file in torrent is added. For multi-file torrents, name and path are
  1018. added to form a URI for each file.
  1019. .. note::
  1020. Make sure that URI is quoted with single(``'``) or double(``"``) quotation if it
  1021. contains ``&`` or any characters that have special meaning in shell.
  1022. Resuming Download
  1023. ~~~~~~~~~~~~~~~~~
  1024. Usually, you can resume transfer by just issuing same command(aria2c
  1025. URI) if the previous transfer is made by aria2.
  1026. If the previous transfer is made by a browser or wget like sequential
  1027. download manager, then use :option:`--continue <-c>` option to continue the transfer.
  1028. Event Hook
  1029. ~~~~~~~~~~
  1030. aria2 provides options to specify arbitrary command after specific event
  1031. occurred. Currently following options are available:
  1032. :option:`--on-bt-download-complete`,
  1033. :option:`--on-download-pause`,
  1034. :option:`--on-download-complete`.
  1035. :option:`--on-download-start`,
  1036. :option:`--on-download-error`,
  1037. :option:`--on-download-stop`.
  1038. aria2 passes 3 arguments to specified command when it is executed.
  1039. These arguments are: GID, the number of files and file path. For
  1040. HTTP, FTP downloads, usually the number of files is 1. BitTorrent
  1041. download can contain multiple files.
  1042. If number of files is more than one, file path is first one. In
  1043. other words, this is the value of path key of first struct whose
  1044. selected key is true in the response of
  1045. :func:`aria2.getFiles`
  1046. RPC method.
  1047. If you want to get all file paths, consider to use JSON-RPC/XML-RPC. Please
  1048. note that file path may change during download in HTTP because of
  1049. redirection or Content-Disposition header.
  1050. Let's see an example of how arguments are passed to command:
  1051. .. code-block:: console
  1052. $ cat hook.sh
  1053. #!/bin/sh
  1054. echo "Called with [$1] [$2] [$3]"
  1055. $ aria2c --on-download-complete hook.sh http://example.org/file.iso
  1056. Called with [1] [1] [/path/to/file.iso]
  1057. EXIT STATUS
  1058. -----------
  1059. Because aria2 can handle multiple downloads at once, it encounters
  1060. lots of errors in a session. aria2 returns the following exit status
  1061. based on the last error encountered.
  1062. 0
  1063. If all downloads were successful.
  1064. 1
  1065. If an unknown error occurred.
  1066. 2
  1067. If time out occurred.
  1068. 3
  1069. If a resource was not found.
  1070. 4
  1071. If aria2 saw the specfied number of "resource not found" error.
  1072. See :option:`--max-file-not-found` option).
  1073. 5
  1074. If a download aborted because download speed was too slow.
  1075. See :option:`--lowest-speed-limit` option)
  1076. 6
  1077. If network problem occurred.
  1078. 7
  1079. If there were unfinished downloads. This error is only reported if
  1080. all finished downloads were successful and there were unfinished
  1081. downloads in a queue when aria2 exited by pressing :kbd:`Ctrl-C` by an user
  1082. or sending TERM or INT signal.
  1083. 8
  1084. If remote server did not support resume when resume was required to
  1085. complete download.
  1086. 9
  1087. If there was not enough disk space available.
  1088. 10
  1089. If piece length was different from one in .aria2 control file. See
  1090. :option:`--allow-piece-length-change` option.
  1091. 11
  1092. If aria2 was downloading same file at that moment.
  1093. 12
  1094. If aria2 was downloading same info hash torrent at that moment.
  1095. 13
  1096. If file already existed. See :option:`--allow-overwrite` option.
  1097. 14
  1098. If renaming file failed. See :option:`--auto-file-renaming` option.
  1099. 15
  1100. If aria2 could not open existing file.
  1101. 16
  1102. If aria2 could not create new file or truncate existing file.
  1103. 17
  1104. If file I/O error occurred.
  1105. 18
  1106. If aria2 could not create directory.
  1107. 19
  1108. If name resolution failed.
  1109. 20
  1110. If aria2 could not parse Metalink document.
  1111. 21
  1112. If FTP command failed.
  1113. 22
  1114. If HTTP response header was bad or unexpected.
  1115. 23
  1116. If too many redirections occurred.
  1117. 24
  1118. If HTTP authorization failed.
  1119. 25
  1120. If aria2 could not parse bencoded file(usually ".torrent" file).
  1121. 26
  1122. If ".torrent" file was corrupted or missing information that aria2 needed.
  1123. 27
  1124. If Magnet URI was bad.
  1125. 28
  1126. If bad/unrecognized option was given or unexpected option argument
  1127. was given.
  1128. 29
  1129. If the remote server was unable to handle the request due to a
  1130. temporary overloading or maintenance.
  1131. 30
  1132. If aria2 could not parse JSON-RPC request.
  1133. .. note::
  1134. An error occurred in a finished download will not be reported
  1135. as exit status.
  1136. ENVIRONMENT
  1137. -----------
  1138. aria2 recognizes the following environment variables.
  1139. ``http_proxy [http://][USER:PASSWORD@]HOST[:PORT]``
  1140. Specify proxy server for use in HTTP.
  1141. Overrides http-proxy value in configuration file.
  1142. The command-line option :option:`--http-proxy` overrides this value.
  1143. ``https_proxy [http://][USER:PASSWORD@]HOST[:PORT]``
  1144. Specify proxy server for use in HTTPS.
  1145. Overrides https-proxy value in configuration file.
  1146. The command-line option :option:`--https-proxy` overrides this value.
  1147. ``ftp_proxy [http://][USER:PASSWORD@]HOST[:PORT]``
  1148. Specify proxy server for use in FTP.
  1149. Overrides ftp-proxy value in configuration file.
  1150. The command-line option :option:`--ftp-proxy` overrides this value.
  1151. ``all_proxy [http://][USER:PASSWORD@]HOST[:PORT]``
  1152. Specify proxy server for use if no protocol-specific proxy is specified.
  1153. Overrides all-proxy value in configuration file.
  1154. The command-line option :option:`--all-proxy` overrides this value.
  1155. .. note::
  1156. Although aria2 accepts ``ftp://`` and ``https://`` scheme in proxy URI, it
  1157. simply assumes that ``http://`` is specified and does not change its
  1158. behavior based on the specified scheme.
  1159. ``no_proxy [DOMAIN,...]``
  1160. Specify comma-separated hostname, domains and network address with
  1161. or without CIDR block to which proxy should not be used. Overrides
  1162. no-proxy value in configuration file. The command-line option
  1163. :option:`--no-proxy` overrides this value.
  1164. FILES
  1165. -----
  1166. aria2.conf
  1167. ~~~~~~~~~~
  1168. By default, aria2 parses ``$HOME/.aria2/aria2.conf`` as a
  1169. configuraiton file. You can specify the path to configuration file
  1170. using :option:`--conf-path` option. If you don't want to use the
  1171. configuraiton file, use :option:`--no-conf` option.
  1172. The configuration file is a text file and has 1 option per each
  1173. line. In each line, you can specify name-value pair in the format:
  1174. ``NAME=VALUE``, where name is the long command-line option name without
  1175. ``--`` prefix. You can use same syntax for the command-line option. The
  1176. lines beginning ``#`` are treated as comments::
  1177. # sample configuration file for aria2c
  1178. listen-port=60000
  1179. dht-listen-port=60000
  1180. seed-ratio=1.0
  1181. max-upload-limit=50K
  1182. ftp-pasv=true
  1183. .. note::
  1184. The confidential information such as user/password might be included
  1185. in the configuration file. It is recommended to change file mode
  1186. bits of the configuration file (e.g., ``chmod 600 aria2.conf``), so
  1187. that other user cannot see the contents of the file.
  1188. dht.dat
  1189. ~~~~~~~~
  1190. By default, the routing table of IPv4 DHT is saved to the path
  1191. ``$HOME/.aria2/dht.dat`` and the routing table of IPv6 DHT is saved to
  1192. the path ``$HOME/.aria2/dht6.dat``.
  1193. Netrc
  1194. ~~~~~
  1195. Netrc support is enabled by default for HTTP(S)/FTP. To disable netrc
  1196. support, specify :option:`--no-netrc <-n>` option. Your .netrc file should have correct
  1197. permissions(600).
  1198. If machine name starts ``.``, aria2 performs domain-match instead of
  1199. exact match. This is an extension of aria2. For example of domain
  1200. match, imagine the following .netrc entry::
  1201. machine .example.org login myid password mypasswd
  1202. ``aria2.example.org`` domain-matches ``.example.org`` and uses ``myid`` and
  1203. ``mypasswd``.
  1204. Some domain-match example follow: ``example.net`` does not domain-match
  1205. ``.example.org``. ``example.org`` does not domain-match ``.example.org``
  1206. because of preceding ``.``. If you want to match ``example.org``, specify
  1207. ``example.org``.
  1208. Control File
  1209. ~~~~~~~~~~~~
  1210. aria2 uses a control file to track the progress of a download. A
  1211. control file is placed in the same directory as the downloading file
  1212. and its filename is the filename of downloading file with ``.aria2``
  1213. appended. For example, if you are downloading file.zip, then the
  1214. control file should be file.zip.aria2. (There is a exception for this
  1215. naming convention. If you are downloading a multi torrent, its
  1216. control file is the "top directory" name of the torrent with ``.aria2``
  1217. appended. The "top directory" name is a value of "name" key in "info"
  1218. directory in a torrent file.)
  1219. Usually a control file is deleted once download completed. If aria2
  1220. decides that download cannot be resumed(for example, when downloading
  1221. a file from a HTTP server which doesn't support resume), a control
  1222. file is not created.
  1223. Normally if you lose a control file, you cannot resume download. But
  1224. if you have a torrent or metalink with chunk checksums for the file,
  1225. you can resume the download without a control file by giving -V option
  1226. to aria2c in command-line.
  1227. Input File
  1228. ~~~~~~~~~~
  1229. The input file can contain a list of URIs for aria2 to download. You
  1230. can specify multiple URIs for a single entity: separate URIs on a
  1231. single line using the TAB character.
  1232. Each line is treated as if it is provided in command-line argument.
  1233. Therefore they are affected by :option:`--force-sequential <-Z>` and :option:`--parameterized-uri <-P>` options.
  1234. Since URIs in the input file are directly read by aria2, they must not
  1235. be quoted with single(``'``) or double(``"``) quotation.
  1236. Lines starting with ``#`` are treated as comments and skipped.
  1237. Additionally, the following options can be specified after each line
  1238. of URIs. These optional lines must start with white space(s).
  1239. .. hlist::
  1240. :columns: 3
  1241. * :option:`all-proxy <--all-proxy>`
  1242. * :option:`all-proxy-passwd <--all-proxy-passwd>`
  1243. * :option:`all-proxy-user <--all-proxy-user>`
  1244. * :option:`allow-overwrite <--allow-overwrite>`
  1245. * :option:`allow-piece-length-change <--allow-piece-length-change>`
  1246. * :option:`always-resume <--always-resume>`
  1247. * :option:`async-dns <--async-dns>`
  1248. * :option:`auto-file-renaming <--auto-file-renaming>`
  1249. * :option:`bt-enable-lpd <--bt-enable-lpd>`
  1250. * :option:`bt-exclude-tracker <--bt-exclude-tracker>`
  1251. * :option:`bt-external-ip <--bt-external-ip>`
  1252. * :option:`bt-hash-check-seed <--bt-hash-check-seed>`
  1253. * :option:`bt-max-open-files <--bt-max-open-files>`
  1254. * :option:`bt-max-peers <--bt-max-peers>`
  1255. * :option:`bt-metadata-only <--bt-metadata-only>`
  1256. * :option:`bt-min-crypto-level <--bt-min-crypto-level>`
  1257. * :option:`bt-prioritize-piece <--bt-prioritize-piece>`
  1258. * :option:`bt-remove-unselected-file <--bt-remove-unselected-file>`
  1259. * :option:`bt-request-peer-speed-limit <--bt-request-peer-speed-limit>`
  1260. * :option:`bt-require-crypto <--bt-require-crypto>`
  1261. * :option:`bt-save-metadata <--bt-save-metadata>`
  1262. * :option:`bt-seed-unverified <--bt-seed-unverified>`
  1263. * :option:`bt-stop-timeout <--bt-stop-timeout>`
  1264. * :option:`bt-tracker <--bt-tracker>`
  1265. * :option:`bt-tracker-connect-timeout <--bt-tracker-connect-timeout>`
  1266. * :option:`bt-tracker-interval <--bt-tracker-interval>`
  1267. * :option:`bt-tracker-timeout <--bt-tracker-timeout>`
  1268. * :option:`check-integrity <-V>`
  1269. * :option:`checksum <--checksum>`
  1270. * :option:`conditional-get <--conditional-get>`
  1271. * :option:`connect-timeout <--connect-timeout>`
  1272. * :option:`continue <-c>`
  1273. * :option:`dir <-d>`
  1274. * :option:`dry-run <--dry-run>`
  1275. * :option:`enable-async-dns6 <--enable-async-dns6>`
  1276. * :option:`enable-http-keep-alive <--enable-http-keep-alive>`
  1277. * :option:`enable-http-pipelining <--enable-http-pipelining>`
  1278. * :option:`enable-mmap <--enable-mmap>`
  1279. * :option:`enable-peer-exchange <--enable-peer-exchange>`
  1280. * :option:`file-allocation <--file-allocation>`
  1281. * :option:`follow-metalink <--follow-metalink>`
  1282. * :option:`follow-torrent <--follow-torrent>`
  1283. * :option:`force-save <--force-save>`
  1284. * :option:`ftp-passwd <--ftp-passwd>`
  1285. * :option:`ftp-pasv <-p>`
  1286. * :option:`ftp-proxy <--ftp-proxy>`
  1287. * :option:`ftp-proxy-passwd <--ftp-proxy-passwd>`
  1288. * :option:`ftp-proxy-user <--ftp-proxy-user>`
  1289. * :option:`ftp-reuse-connection <--ftp-reuse-connection>`
  1290. * :option:`ftp-type <--ftp-type>`
  1291. * :option:`ftp-user <--ftp-user>`
  1292. * :option:`hash-check-only <--hash-check-only>`
  1293. * :option:`header <--header>`
  1294. * :option:`http-accept-gzip <--http-accept-gzip>`
  1295. * :option:`http-auth-challenge <--http-auth-challenge>`
  1296. * :option:`http-no-cache <--http-no-cache>`
  1297. * :option:`http-passwd <--http-passwd>`
  1298. * :option:`http-proxy <--http-proxy>`
  1299. * :option:`http-proxy-passwd <--http-proxy-passwd>`
  1300. * :option:`http-proxy-user <--http-proxy-user>`
  1301. * :option:`http-user <--http-user>`
  1302. * :option:`https-proxy <--https-proxy>`
  1303. * :option:`https-proxy-passwd <--https-proxy-passwd>`
  1304. * :option:`https-proxy-user <--https-proxy-user>`
  1305. * :option:`index-out <-O>`
  1306. * :option:`lowest-speed-limit <--lowest-speed-limit>`
  1307. * :option:`max-connection-per-server <-x>`
  1308. * :option:`max-download-limit <--max-download-limit>`
  1309. * :option:`max-file-not-found <--max-file-not-found>`
  1310. * :option:`max-resume-failure-tries <--max-resume-failure-tries>`
  1311. * :option:`max-tries <-m>`
  1312. * :option:`max-upload-limit <-u>`
  1313. * :option:`metalink-base-uri <--metalink-base-uri>`
  1314. * :option:`metalink-enable-unique-protocol <--metalink-enable-unique-protocol>`
  1315. * :option:`metalink-language <--metalink-language>`
  1316. * :option:`metalink-location <--metalink-location>`
  1317. * :option:`metalink-os <--metalink-os>`
  1318. * :option:`metalink-preferred-protocol <--metalink-preferred-protocol>`
  1319. * :option:`metalink-version <--metalink-version>`
  1320. * :option:`min-split-size <-k>`
  1321. * :option:`no-file-allocation-limit <--no-file-allocation-limit>`
  1322. * :option:`no-netrc <-n>`
  1323. * :option:`no-proxy <--no-proxy>`
  1324. * :option:`out <-o>`
  1325. * :option:`parameterized-uri <-P>`
  1326. * :option:`pause <--pause>`
  1327. * :option:`piece-length <--piece-length>`
  1328. * :option:`proxy-method <--proxy-method>`
  1329. * :option:`realtime-chunk-checksum <--realtime-chunk-checksum>`
  1330. * :option:`referer <--referer>`
  1331. * :option:`remote-time <-R>`
  1332. * :option:`remove-control-file <--remove-control-file>`
  1333. * :option:`retry-wait <--retry-wait>`
  1334. * :option:`reuse-uri <--reuse-uri>`
  1335. * :option:`rpc-save-upload-metadata <--rpc-save-upload-metadata>`
  1336. * :option:`seed-ratio <--seed-ratio>`
  1337. * :option:`seed-time <--seed-time>`
  1338. * :option:`select-file <--select-file>`
  1339. * :option:`split <-s>`
  1340. * :option:`stream-piece-selector <--stream-piece-selector>`
  1341. * :option:`timeout <-t>`
  1342. * :option:`uri-selector <--uri-selector>`
  1343. * :option:`use-head <--use-head>`
  1344. * :option:`user-agent <-U>`
  1345. These options have exactly same meaning of the ones in the
  1346. command-line options, but it just applies to the URIs it belongs to.
  1347. Please note that for options in input file ``--`` prefix must be
  1348. stripped.
  1349. For example, the content of uri.txt is::
  1350. http://server/file.iso http://mirror/file.iso
  1351. dir=/iso_images
  1352. out=file.img
  1353. http://foo/bar
  1354. If aria2 is executed with ``-i uri.txt -d /tmp`` options, then
  1355. ``file.iso`` is saved as ``/iso_images/file.img`` and it is downloaded
  1356. from ``http://server/file.iso`` and ``http://mirror/file.iso``. The file
  1357. ``bar`` is downloaded from ``http://foo/bar`` and saved as ``/tmp/bar``.
  1358. In some cases, :option:`out <-o>` parameter has no effect.
  1359. See note of :option:`--out <-o>`
  1360. option for the restrictions.
  1361. Server Performance Profile
  1362. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1363. This section describes the format of server performance profile. The
  1364. file is plain text and each line has several ``NAME=VALUE`` pair,
  1365. delimited by comma. Currently following NAMEs are recognized:
  1366. ``host``
  1367. Hostname of the server. Required.
  1368. ``protocol``
  1369. Protocol for this profile, such as ftp, http. Required.
  1370. ``dl_speed``
  1371. The average download speed observed in the previous download in
  1372. bytes per sec. Required.
  1373. ``sc_avg_speed``
  1374. The average download speed observed in the previous download in
  1375. bytes per sec. This value is only updated if the download is done in
  1376. single connection environment and only used by
  1377. AdaptiveURISelector. Optional.
  1378. ``mc_avg_speed``
  1379. The average download speed observed in the previous download in
  1380. bytes per sec. This value is only updated if the download is done in
  1381. multi connection environment and only used by
  1382. AdaptiveURISelector. Optional.
  1383. ``counter``
  1384. How many times the server is used. Currently this value is only used
  1385. by AdaptiveURISelector. Optional.
  1386. ``last_updated``
  1387. Last contact time in GMT with this server, specified in the seconds
  1388. since the Epoch(00:00:00 on January 1, 1970, UTC). Required.
  1389. ``status``
  1390. ERROR is set when server cannot be reached or out-of-service or
  1391. timeout occurred. Otherwise, OK is set.
  1392. Those fields must exist in one line. The order of the fields is not
  1393. significant. You can put pairs other than the above; they are simply
  1394. ignored.
  1395. An example follows::
  1396. host=localhost, protocol=http, dl_speed=32000, last_updated=1222491640, status=OK
  1397. host=localhost, protocol=ftp, dl_speed=0, last_updated=1222491632, status=ERROR
  1398. RPC INTERFACE
  1399. -------------
  1400. aria2 provides JSON-RPC over HTTP and XML-RPC over HTTP and they
  1401. basically have the same functionality. aria2 also provides JSON-RPC
  1402. over WebSocket. JSON-RPC over WebSocket uses same method signatures
  1403. and response format with JSON-RPC over HTTP, but it additionally has
  1404. server-initiated notifications. See `JSON-RPC over WebSocket`_ section for details.
  1405. The request path of JSON-RPC interface (for both over HTTP and over
  1406. WebSocket) is ``/jsonrpc``. The request path of XML-RPC interface is
  1407. ``/rpc``.
  1408. The WebSocket URI for JSON-RPC over WebSocket is
  1409. ``ws://HOST:PORT/jsonrpc``. If you enabled SSL/TLS encryption, use
  1410. ``wss://HOST:PORT/jsonrpc`` instead.
  1411. The implemented JSON-RPC is based on
  1412. JSON-RPC 2.0 <http://jsonrpc.org/specification>, and
  1413. supports HTTP POST and GET (JSONP). Using WebSocket as a transport is
  1414. the original extension of aria2.
  1415. The JSON-RPC interface does not support notification in HTTP, but the
  1416. RPC server will send the notification in WebSocket. It also does not
  1417. support floating point number. The character encoding must be UTF-8.
  1418. When reading following document for JSON-RPC, interpret struct as JSON
  1419. object.
  1420. Terminology
  1421. ~~~~~~~~~~~
  1422. GID
  1423. GID(or gid) is the key to manage each download. Each download has an
  1424. unique GID. GID is stored in 64 bits binary data in aria2. For RPC
  1425. access, it is represented in hex string of 16 characters (e.g.,
  1426. ``2089b05ecca3d829``). Normally, aria2 generates this GID for each
  1427. download, but the user can specify GID manually using :option:`--gid
  1428. <--gid>` option. When querying download by GID, you can specify the
  1429. prefix of GID as long as it is a unique prefix among others.
  1430. Methods
  1431. ~~~~~~~
  1432. All code examples come from Python2.7 interpreter.
  1433. .. function:: aria2.addUri(uris[, options[, position]])
  1434. This method adds new HTTP(S)/FTP/BitTorrent Magnet URI. *uris* is of
  1435. type array and its element is URI which is of type string. For
  1436. BitTorrent Magnet URI, *uris* must have only one element and it should
  1437. be BitTorrent Magnet URI. URIs in *uris* must point to the same file.
  1438. If you mix other URIs which point to another file, aria2 does not
  1439. complain but download may fail. *options* is of type struct and its
  1440. members are a pair of option name and value. See :ref:`rpc_options` below for
  1441. more details. If *position* is given as an integer starting from 0,
  1442. the new download is inserted at *position* in the waiting queue. If
  1443. *position* is not given or *position* is larger than the size of the
  1444. queue, it is appended at the end of the queue. This method returns
  1445. GID of registered download.
  1446. **JSON-RPC Example**
  1447. The following example adds ``http://example.org/file``::
  1448. >>> import urllib2, json
  1449. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1450. ... 'method':'aria2.addUri',
  1451. ... 'params':[['http://example.org/file']]})
  1452. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1453. >>> c.read()
  1454. '{"id":"qwer","jsonrpc":"2.0","result":"2089b05ecca3d829"}'
  1455. **XML-RPC Example**
  1456. The following example adds ``http://example.org/file``::
  1457. >>> import xmlrpclib
  1458. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1459. >>> s.aria2.addUri(['http://example.org/file'])
  1460. '2089b05ecca3d829'
  1461. The following example adds 2 sources and some options::
  1462. >>> s.aria2.addUri(['http://example.org/file', 'http://mirror/file'],
  1463. dict(dir="/tmp"))
  1464. 'd2703803b52216d1'
  1465. The following example adds a download and insert it to the front of
  1466. waiting downloads::
  1467. >>> s.aria2.addUri(['http://example.org/file'], {}, 0)
  1468. 'ca3d829cee549a4d'
  1469. .. function:: aria2.addTorrent(torrent[, uris[, options[, position]]])
  1470. This method adds BitTorrent download by uploading ".torrent" file.
  1471. If you want to add BitTorrent Magnet URI, use :func:`aria2.addUri`
  1472. method instead. *torrent* is of type base64 which contains
  1473. Base64-encoded ".torrent" file. *uris* is of type array and its
  1474. element is URI which is of type string. *uris* is used for
  1475. Web-seeding. For single file torrents, URI can be a complete URI
  1476. pointing to the resource or if URI ends with /, name in torrent file
  1477. is added. For multi-file torrents, name and path in torrent are
  1478. added to form a URI for each file. *options* is of type struct and
  1479. its members are a pair of option name and value. See
  1480. :ref:`rpc_options` below for more details. If *position* is given
  1481. as an integer starting from 0, the new download is inserted at
  1482. *position* in the waiting queue. If *position* is not given or
  1483. *position* is larger than the size of the queue, it is appended at
  1484. the end of the queue. This method returns GID of registered
  1485. download. If :option:`--rpc-save-upload-metadata` is ``true``, the
  1486. uploaded data is saved as a file named hex string of SHA-1 hash of
  1487. data plus ".torrent" in the directory specified by :option:`--dir
  1488. <-d>` option. The example of filename is
  1489. ``0a3893293e27ac0490424c06de4d09242215f0a6.torrent``. If same file
  1490. already exists, it is overwritten. If the file cannot be saved
  1491. successfully or :option:`--rpc-save-upload-metadata` is ``false``,
  1492. the downloads added by this method are not saved by
  1493. :option:`--save-session`.
  1494. The following examples add local file ``file.torrent``.
  1495. **JSON-RPC Example**
  1496. ::
  1497. >>> import urllib2, json, base64
  1498. >>> torrent = base64.b64encode(open('file.torrent').read())
  1499. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'asdf',
  1500. ... 'method':'aria2.addTorrent', 'params':[torrent]})
  1501. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1502. >>> c.read()
  1503. '{"id":"asdf","jsonrpc":"2.0","result":"2089b05ecca3d829"}'
  1504. **XML-RPC Example**
  1505. ::
  1506. >>> import xmlrpclib
  1507. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1508. >>> s.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent').read()))
  1509. '2089b05ecca3d829'
  1510. .. function:: aria2.addMetalink(metalink[, options[, position]])
  1511. This method adds Metalink download by uploading ".metalink" file.
  1512. *metalink* is of type base64 which contains Base64-encoded
  1513. ".metalink" file. *options* is of type struct and its members are a
  1514. pair of option name and value. See :ref:`rpc_options` below for more
  1515. details. If *position* is given as an integer starting from 0, the
  1516. new download is inserted at *position* in the waiting queue. If
  1517. *position* is not given or *position* is larger than the size of the
  1518. queue, it is appended at the end of the queue. This method returns
  1519. array of GID of registered download. If
  1520. :option:`--rpc-save-upload-metadata` is ``true``, the uploaded data
  1521. is saved as a file named hex string of SHA-1 hash of data plus
  1522. ".metalink" in the directory specified by :option:`--dir <-d>`
  1523. option. The example of filename is
  1524. ``0a3893293e27ac0490424c06de4d09242215f0a6.metalink``. If same file
  1525. already exists, it is overwritten. If the file cannot be saved
  1526. successfully or :option:`--rpc-save-upload-metadata` is ``false``,
  1527. the downloads added by this method are not saved by
  1528. :option:`--save-session`.
  1529. The following examples add local file file.meta4.
  1530. **JSON-RPC Example**
  1531. ::
  1532. >>> import urllib2, json, base64
  1533. >>> metalink = base64.b64encode(open('file.meta4').read())
  1534. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1535. ... 'method':'aria2.addMetalink',
  1536. ... 'params':[metalink]})
  1537. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1538. >>> c.read()
  1539. '{"id":"qwer","jsonrpc":"2.0","result":["2089b05ecca3d829"]}'
  1540. **XML-RPC Example**
  1541. ::
  1542. >>> import xmlrpclib
  1543. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1544. >>> s.aria2.addMetalink(xmlrpclib.Binary(open('file.meta4').read()))
  1545. ['2089b05ecca3d829']
  1546. .. function:: aria2.remove(gid)
  1547. This method removes the download denoted by *gid*. *gid* is of type
  1548. string. If specified download is in progress, it is stopped at
  1549. first. The status of removed download becomes ``removed``. This method
  1550. returns GID of removed download.
  1551. The following examples remove download GID#2089b05ecca3d829.
  1552. **JSON-RPC Example**
  1553. ::
  1554. >>> import urllib2, json
  1555. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1556. ... 'method':'aria2.remove',
  1557. ... 'params':['2089b05ecca3d829']})
  1558. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1559. >>> c.read()
  1560. '{"id":"qwer","jsonrpc":"2.0","result":"2089b05ecca3d829"}'
  1561. **XML-RPC Example**
  1562. ::
  1563. >>> import xmlrpclib
  1564. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1565. >>> s.aria2.remove('2089b05ecca3d829')
  1566. '2089b05ecca3d829'
  1567. .. function:: aria2.forceRemove(gid)
  1568. This method removes the download denoted by *gid*. This method
  1569. behaves just like :func:`aria2.remove` except that this method removes
  1570. download without any action which takes time such as contacting
  1571. BitTorrent tracker.
  1572. .. function:: aria2.pause(gid)
  1573. This method pauses the download denoted by *gid*. *gid* is of type
  1574. string. The status of paused download becomes ``paused``. If the
  1575. download is active, the download is placed on the first position of
  1576. waiting queue. As long as the status is ``paused``, the download is not
  1577. started. To change status to ``waiting``, use :func:`aria2.unpause` method.
  1578. This method returns GID of paused download.
  1579. .. function:: aria2.pauseAll()
  1580. This method is equal to calling :func:`aria2.pause` for every active/waiting
  1581. download. This methods returns ``OK`` for success.
  1582. .. function:: aria2.forcePause(pid)
  1583. This method pauses the download denoted by *gid*. This method
  1584. behaves just like :func:`aria2.pause` except that this method pauses
  1585. download without any action which takes time such as contacting
  1586. BitTorrent tracker.
  1587. .. function:: aria2.forcePauseAll()
  1588. This method is equal to calling :func:`aria2.forcePause` for every
  1589. active/waiting download. This methods returns ``OK`` for success.
  1590. .. function:: aria2.unpause(gid)
  1591. This method changes the status of the download denoted by *gid* from
  1592. ``paused`` to ``waiting``. This makes the download eligible to restart.
  1593. *gid* is of type string. This method returns GID of unpaused
  1594. download.
  1595. .. function:: aria2.unpauseAll()
  1596. This method is equal to calling :func:`aria2.unpause` for every active/waiting
  1597. download. This methods returns ``OK`` for success.
  1598. .. function:: aria2.tellStatus(gid[, keys])
  1599. This method returns download progress of the download denoted by
  1600. *gid*. *gid* is of type string. *keys* is array of string. If it is
  1601. specified, the response contains only keys in *keys* array. If *keys*
  1602. is empty or not specified, the response contains all keys. This is
  1603. useful when you just want specific keys and avoid unnecessary
  1604. transfers. For example, ``aria2.tellStatus("2089b05ecca3d829", ["gid", "status"])``
  1605. returns *gid* and 'status' key. The response is of type struct and it
  1606. contains following keys. The value type is string.
  1607. ``gid``
  1608. GID of this download.
  1609. ``status``
  1610. ``active`` for currently downloading/seeding entry. ``waiting`` for the
  1611. entry in the queue; download is not started. ``paused`` for the
  1612. paused entry. ``error`` for the stopped download because of
  1613. error. ``complete`` for the stopped and completed download. ``removed``
  1614. for the download removed by user.
  1615. ``totalLength``
  1616. Total length of this download in bytes.
  1617. ``completedLength``
  1618. Completed length of this download in bytes.
  1619. ``uploadLength``
  1620. Uploaded length of this download in bytes.
  1621. ``bitfield``
  1622. Hexadecimal representation of the download progress. The highest bit
  1623. corresponds to piece index 0. The set bits indicate the piece is
  1624. available and unset bits indicate the piece is missing. The spare
  1625. bits at the end are set to zero. When download has not started yet,
  1626. this key will not be included in the response.
  1627. ``downloadSpeed``
  1628. Download speed of this download measured in bytes/sec.
  1629. ``uploadSpeed``
  1630. Upload speed of this download measured in bytes/sec.
  1631. ``infoHash``
  1632. InfoHash. BitTorrent only.
  1633. ``numSeeders``
  1634. The number of seeders the client has connected to. BitTorrent only.
  1635. ``pieceLength``
  1636. Piece length in bytes.
  1637. ``numPieces``
  1638. The number of pieces.
  1639. ``connections``
  1640. The number of peers/servers the client has connected to.
  1641. ``errorCode``
  1642. The last error code occurred in this download. The value is of type
  1643. string. The error codes are defined in `EXIT STATUS`_ section. This value is only available for
  1644. stopped/completed downloads.
  1645. ``followedBy``
  1646. List of GIDs which are generated by the consequence of this
  1647. download. For example, when aria2 downloaded Metalink file, it
  1648. generates downloads described in it(see :option:`--follow-metalink`
  1649. option). This value is useful to track these auto generated
  1650. downloads. If there is no such downloads, this key will not
  1651. be included in the response.
  1652. ``belongsTo``
  1653. GID of a parent download. Some downloads are a part of another
  1654. download. For example, if a file in Metalink has BitTorrent
  1655. resource, the download of ".torrent" is a part of that file. If this
  1656. download has no parent, this key will not be included in the
  1657. response.
  1658. ``dir``
  1659. Directory to save files. This key is not available for stopped
  1660. downloads.
  1661. ``files``
  1662. Returns the list of files. The element of list is the same struct
  1663. used in :func:`aria2.getFiles` method.
  1664. ``bittorrent``
  1665. Struct which contains information retrieved from .torrent
  1666. file. BitTorrent only. It contains following keys.
  1667. ``announceList``
  1668. List of lists of announce URI. If ".torrent" file contains announce
  1669. and no announce-list, announce is converted to announce-list
  1670. format.
  1671. ``comment``
  1672. The comment for the torrent. ``comment.utf-8`` is used if available.
  1673. ``creationDate``
  1674. The creation time of the torrent. The value is an integer since
  1675. the Epoch, measured in seconds.
  1676. ``mode``
  1677. File mode of the torrent. The value is either ``single`` or ``multi``.
  1678. ``info``
  1679. Struct which contains data from Info dictionary. It contains
  1680. following keys.
  1681. ``name``
  1682. name in info dictionary. ``name.utf-8`` is used if available.
  1683. **JSON-RPC Example**
  1684. The following example gets information about download GID#2089b05ecca3d829::
  1685. >>> import urllib2, json
  1686. >>> from pprint import pprint
  1687. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1688. ... 'method':'aria2.tellStatus',
  1689. ... 'params':['2089b05ecca3d829']})
  1690. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1691. >>> pprint(json.loads(c.read()))
  1692. {u'id': u'qwer',
  1693. u'jsonrpc': u'2.0',
  1694. u'result': {u'bitfield': u'0000000000',
  1695. u'completedLength': u'901120',
  1696. u'connections': u'1',
  1697. u'dir': u'/downloads',
  1698. u'downloadSpeed': u'15158',
  1699. u'files': [{u'index': u'1',
  1700. u'length': u'34896138',
  1701. u'completedLength': u'34896138',
  1702. u'path': u'/downloads/file',
  1703. u'selected': u'true',
  1704. u'uris': [{u'status': u'used',
  1705. u'uri': u'http://example.org/file'}]}],
  1706. u'gid': u'2089b05ecca3d829',
  1707. u'numPieces': u'34',
  1708. u'pieceLength': u'1048576',
  1709. u'status': u'active',
  1710. u'totalLength': u'34896138',
  1711. u'uploadLength': u'0',
  1712. u'uploadSpeed': u'0'}}
  1713. The following example gets information specifying keys you are
  1714. interested in::
  1715. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1716. ... 'method':'aria2.tellStatus',
  1717. ... 'params':['2089b05ecca3d829',
  1718. ... ['gid',
  1719. ... 'totalLength',
  1720. ... 'completedLength']]})
  1721. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1722. >>> pprint(json.loads(c.read()))
  1723. {u'id': u'qwer',
  1724. u'jsonrpc': u'2.0',
  1725. u'result': {u'completedLength': u'5701632',
  1726. u'gid': u'2089b05ecca3d829',
  1727. u'totalLength': u'34896138'}}
  1728. **XML-RPC Example**
  1729. The following example gets information about download GID#2089b05ecca3d829::
  1730. >>> import xmlrpclib
  1731. >>> from pprint import pprint
  1732. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1733. >>> r = s.aria2.tellStatus('2089b05ecca3d829')
  1734. >>> pprint(r)
  1735. {'bitfield': 'ffff80',
  1736. 'completedLength': '34896138',
  1737. 'connections': '0',
  1738. 'dir': '/downloads',
  1739. 'downloadSpeed': '0',
  1740. 'errorCode': '0',
  1741. 'files': [{'index': '1',
  1742. 'length': '34896138',
  1743. 'completedLength': '34896138',
  1744. 'path': '/downloads/file',
  1745. 'selected': 'true',
  1746. 'uris': [{'status': 'used',
  1747. 'uri': 'http://example.org/file'}]}],
  1748. 'gid': '2089b05ecca3d829',
  1749. 'numPieces': '17',
  1750. 'pieceLength': '2097152',
  1751. 'status': 'complete',
  1752. 'totalLength': '34896138',
  1753. 'uploadLength': '0',
  1754. 'uploadSpeed': '0'}
  1755. The following example gets information specifying keys you are
  1756. interested in::
  1757. >>> r = s.aria2.tellStatus('2089b05ecca3d829', ['gid', 'totalLength', 'completedLength'])
  1758. >>> pprint(r)
  1759. {'completedLength': '34896138', 'gid': '2089b05ecca3d829', 'totalLength': '34896138'}
  1760. .. function:: aria2.getUris(gid)
  1761. This method returns URIs used in the download denoted by *gid*. *gid*
  1762. is of type string. The response is of type array and its element is of
  1763. type struct and it contains following keys. The value type is string.
  1764. ``uri``
  1765. URI
  1766. ``status``
  1767. 'used' if the URI is already used. 'waiting' if the URI is waiting
  1768. in the queue.
  1769. **JSON-RPC Example**
  1770. ::
  1771. >>> import urllib2, json
  1772. >>> from pprint import pprint
  1773. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1774. ... 'method':'aria2.getUris',
  1775. ... 'params':['2089b05ecca3d829']})
  1776. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1777. >>> pprint(json.loads(c.read()))
  1778. {u'id': u'qwer',
  1779. u'jsonrpc': u'2.0',
  1780. u'result': [{u'status': u'used',
  1781. u'uri': u'http://example.org/file'}]}
  1782. **XML-RPC Example**
  1783. ::
  1784. >>> import xmlrpclib
  1785. >>> from pprint import pprint
  1786. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1787. >>> r = s.aria2.getUris('2089b05ecca3d829')
  1788. >>> pprint(r)
  1789. [{'status': 'used', 'uri': 'http://example.org/file'}]
  1790. .. function:: aria2.getFiles(gid)
  1791. This method returns file list of the download denoted by *gid*. *gid*
  1792. is of type string. The response is of type array and its element is of
  1793. type struct and it contains following keys. The value type is string.
  1794. ``index``
  1795. Index of file. Starting with 1. This is the same order with the
  1796. files in multi-file torrent.
  1797. ``path``
  1798. File path.
  1799. ``length``
  1800. File size in bytes.
  1801. ``completedLength``
  1802. Completed length of this file in bytes. Please note that it is
  1803. possible that sum of completedLength is less than completedLength in
  1804. :func:`aria2.tellStatus` method.
  1805. This is because completedLength in
  1806. :func:`aria2.getFiles`
  1807. only calculates completed pieces. On the other hand, completedLength
  1808. in
  1809. :func:`aria2.tellStatus` takes into account
  1810. of partially completed piece.
  1811. ``selected``
  1812. ``true`` if this file is selected by :option:`--select-file` option. If
  1813. :option:`--select-file` is not specified or this is single torrent or no
  1814. torrent download, this value is always ``true``. Otherwise ``false``.
  1815. ``uris``
  1816. Returns the list of URI for this file. The element of list is the
  1817. same struct used in :func:`aria2.getUris` method.
  1818. **JSON-RPC Example**
  1819. ::
  1820. >>> import urllib2, json
  1821. >>> from pprint import pprint
  1822. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1823. ... 'method':'aria2.getFiles',
  1824. ... 'params':['2089b05ecca3d829']})
  1825. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1826. >>> pprint(json.loads(c.read()))
  1827. {u'id': u'qwer',
  1828. u'jsonrpc': u'2.0',
  1829. u'result': [{u'index': u'1',
  1830. u'length': u'34896138',
  1831. u'completedLength': u'34896138',
  1832. u'path': u'/downloads/file',
  1833. u'selected': u'true',
  1834. u'uris': [{u'status': u'used',
  1835. u'uri': u'http://example.org/file'}]}]}
  1836. **XML-RPC Example**
  1837. ::
  1838. >>> import xmlrpclib
  1839. >>> from pprint import pprint
  1840. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1841. >>> r = s.aria2.getFiles('2089b05ecca3d829')
  1842. >>> pprint(r)
  1843. [{'index': '1',
  1844. 'length': '34896138',
  1845. 'completedLength': '34896138',
  1846. 'path': '/downloads/file',
  1847. 'selected': 'true',
  1848. 'uris': [{'status': 'used',
  1849. 'uri': 'http://example.org/file'}]}]
  1850. .. function:: aria2.getPeers(gid)
  1851. This method returns peer list of the download denoted by *gid*. *gid*
  1852. is of type string. This method is for BitTorrent only. The response
  1853. is of type array and its element is of type struct and it contains
  1854. following keys. The value type is string.
  1855. ``peerId``
  1856. Percent-encoded peer ID.
  1857. ``ip``
  1858. IP address of the peer.
  1859. ``port``
  1860. Port number of the peer.
  1861. ``bitfield``
  1862. Hexadecimal representation of the download progress of the peer. The
  1863. highest bit corresponds to piece index 0. The set bits indicate the
  1864. piece is available and unset bits indicate the piece is missing. The
  1865. spare bits at the end are set to zero.
  1866. ``amChoking``
  1867. ``true`` if this client is choking the peer. Otherwise ``false``.
  1868. ``peerChoking``
  1869. ``true`` if the peer is choking this client. Otherwise ``false``.
  1870. ``downloadSpeed``
  1871. Download speed (byte/sec) that this client obtains from the peer.
  1872. ``uploadSpeed``
  1873. Upload speed(byte/sec) that this client uploads to the peer.
  1874. ``seeder``
  1875. ``true`` is this client is a seeder. Otherwise ``false``.
  1876. **JSON-RPC Example**
  1877. ::
  1878. >>> import urllib2, json
  1879. >>> from pprint import pprint
  1880. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1881. ... 'method':'aria2.getPeers',
  1882. ... 'params':['2089b05ecca3d829']})
  1883. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1884. >>> pprint(json.loads(c.read()))
  1885. {u'id': u'qwer',
  1886. u'jsonrpc': u'2.0',
  1887. u'result': [{u'amChoking': u'true',
  1888. u'bitfield': u'ffffffffffffffffffffffffffffffffffffffff',
  1889. u'downloadSpeed': u'10602',
  1890. u'ip': u'10.0.0.9',
  1891. u'peerChoking': u'false',
  1892. u'peerId': u'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
  1893. u'port': u'6881',
  1894. u'seeder': u'true',
  1895. u'uploadSpeed': u'0'},
  1896. {u'amChoking': u'false',
  1897. u'bitfield': u'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
  1898. u'downloadSpeed': u'8654',
  1899. u'ip': u'10.0.0.30',
  1900. u'peerChoking': u'false',
  1901. u'peerId': u'bittorrent client758',
  1902. u'port': u'37842',
  1903. u'seeder': u'false',
  1904. u'uploadSpeed': u'6890'}]}
  1905. **XML-RPC Example**
  1906. ::
  1907. >>> import xmlrpclib
  1908. >>> from pprint import pprint
  1909. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1910. >>> r = s.aria2.getPeers('2089b05ecca3d829')
  1911. >>> pprint(r)
  1912. [{'amChoking': 'true',
  1913. 'bitfield': 'ffffffffffffffffffffffffffffffffffffffff',
  1914. 'downloadSpeed': '10602',
  1915. 'ip': '10.0.0.9',
  1916. 'peerChoking': 'false',
  1917. 'peerId': 'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
  1918. 'port': '6881',
  1919. 'seeder': 'true',
  1920. 'uploadSpeed': '0'},
  1921. {'amChoking': 'false',
  1922. 'bitfield': 'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
  1923. 'downloadSpeed': '8654',
  1924. 'ip': '10.0.0.30',
  1925. 'peerChoking': 'false',
  1926. 'peerId': 'bittorrent client758',
  1927. 'port': '37842',
  1928. 'seeder': 'false,
  1929. 'uploadSpeed': '6890'}]
  1930. .. function:: aria2.getServers(gid)
  1931. This method returns currently connected HTTP(S)/FTP servers of the download denoted by *gid*. *gid* is of type string. The response
  1932. is of type array and its element is of type struct and it contains
  1933. following keys. The value type is string.
  1934. ``index``
  1935. Index of file. Starting with 1. This is the same order with the
  1936. files in multi-file torrent.
  1937. ``servers``
  1938. The list of struct which contains following keys.
  1939. ``uri``
  1940. URI originally added.
  1941. ``currentUri``
  1942. This is the URI currently used for downloading. If redirection is
  1943. involved, currentUri and uri may differ.
  1944. ``downloadSpeed``
  1945. Download speed (byte/sec)
  1946. **JSON-RPC Example**
  1947. ::
  1948. >>> import urllib2, json
  1949. >>> from pprint import pprint
  1950. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1951. ... 'method':'aria2.getServers',
  1952. ... 'params':['2089b05ecca3d829']})
  1953. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1954. >>> pprint(json.loads(c.read()))
  1955. {u'id': u'qwer',
  1956. u'jsonrpc': u'2.0',
  1957. u'result': [{u'index': u'1',
  1958. u'servers': [{u'currentUri': u'http://example.org/file',
  1959. u'downloadSpeed': u'10467',
  1960. u'uri': u'http://example.org/file'}]}]}
  1961. **XML-RPC Example**
  1962. ::
  1963. >>> import xmlrpclib
  1964. >>> from pprint import pprint
  1965. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1966. >>> r = s.aria2.getServers('2089b05ecca3d829')
  1967. >>> pprint(r)
  1968. [{'index': '1',
  1969. 'servers': [{'currentUri': 'http://example.org/dl/file',
  1970. 'downloadSpeed': '20285',
  1971. 'uri': 'http://example.org/file'}]}]
  1972. .. function:: aria2.tellActive([keys])
  1973. This method returns the list of active downloads. The response is of
  1974. type array and its element is the same struct returned by
  1975. :func:`aria2.tellStatus` method. For *keys* parameter, please refer to
  1976. :func:`aria2.tellStatus` method.
  1977. .. function:: aria2.tellWaiting(offset, num, [keys])
  1978. This method returns the list of waiting download, including paused
  1979. downloads. *offset* is of type integer and specifies the offset from
  1980. the download waiting at the front. *num* is of type integer and
  1981. specifies the number of downloads to be returned. For *keys*
  1982. parameter, please refer to :func:`aria2.tellStatus` method.
  1983. If *offset* is a positive integer, this method returns downloads in the
  1984. range of [*offset*, *offset* + *num*).
  1985. *offset* can be a negative integer. *offset* == -1 points last
  1986. download in the waiting queue and *offset* == -2 points the download
  1987. before the last download, and so on. The downloads in the response are
  1988. in reversed order.
  1989. For example, imagine that three downloads "A","B" and "C" are waiting
  1990. in this order. ``aria2.tellWaiting(0, 1)`` returns
  1991. ``["A"]``. ``aria2.tellWaiting(1, 2)`` returns ``["B", "C"]``.
  1992. ``aria2.tellWaiting(-1, 2)`` returns ``["C", "B"]``.
  1993. The response is of type array and its element is the same struct
  1994. returned by :func:`aria2.tellStatus` method.
  1995. .. function:: aria2.tellStopped(offset, num, [keys])
  1996. This method returns the list of stopped download. *offset* is of type
  1997. integer and specifies the offset from the oldest download. *num* is of
  1998. type integer and specifies the number of downloads to be returned.
  1999. For *keys* parameter, please refer to :func:`aria2.tellStatus` method.
  2000. *offset* and *num* have the same semantics as :func:`aria2.tellWaiting`
  2001. method.
  2002. The response is of type array and its element is the same struct
  2003. returned by :func:`aria2.tellStatus` method.
  2004. .. function:: aria2.changePosition(gid, pos, how)
  2005. This method changes the position of the download denoted by
  2006. *gid*. *pos* is of type integer. *how* is of type string. If *how* is
  2007. ``POS_SET``, it moves the download to a position relative to the
  2008. beginning of the queue. If *how* is ``POS_CUR``, it moves the download
  2009. to a position relative to the current position. If *how* is ``POS_END``,
  2010. it moves the download to a position relative to the end of the
  2011. queue. If the destination position is less than 0 or beyond the end of
  2012. the queue, it moves the download to the beginning or the end of the
  2013. queue respectively. The response is of type integer and it is the
  2014. destination position.
  2015. For example, if GID#2089b05ecca3d829 is placed in position 3,
  2016. ``aria2.changePosition('2089b05ecca3d829', -1, 'POS_CUR')`` will
  2017. change its position to 2. Additional
  2018. ``aria2.changePosition('2089b05ecca3d829', 0, 'POS_SET')`` will
  2019. change its position to 0(the beginning of the queue).
  2020. The following examples move the download GID#2089b05ecca3d829 to the
  2021. front of the waiting queue.
  2022. **JSON-RPC Example**
  2023. ::
  2024. >>> import urllib2, json
  2025. >>> from pprint import pprint
  2026. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2027. ... 'method':'aria2.changePosition',
  2028. ... 'params':['2089b05ecca3d829', 0, 'POS_SET']})
  2029. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2030. >>> pprint(json.loads(c.read()))
  2031. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': 0}
  2032. **XML-RPC Example**
  2033. ::
  2034. >>> import xmlrpclib
  2035. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2036. >>> s.aria2.changePosition('2089b05ecca3d829', 0, 'POS_SET')
  2037. 0
  2038. .. function:: aria2.changeUri(gid, fileIndex, delUris, addUris[, position])
  2039. This method removes URIs in *delUris* from and appends URIs in
  2040. *addUris* to download denoted by *gid*. *delUris* and *addUris* are
  2041. list of string. A download can contain multiple files and URIs are
  2042. attached to each file. *fileIndex* is used to select which file to
  2043. remove/attach given URIs. *fileIndex* is 1-based. *position* is used
  2044. to specify where URIs are inserted in the existing waiting URI
  2045. list. *position* is 0-based. When *position* is omitted, URIs are
  2046. appended to the back of the list. This method first execute removal
  2047. and then addition. *position* is the position after URIs are removed,
  2048. not the position when this method is called. When removing URI, if
  2049. same URIs exist in download, only one of them is removed for each URI
  2050. in *delUris*. In other words, there are three URIs
  2051. ``http://example.org/aria2`` and you want remove them all, you have to
  2052. specify (at least) 3 ``http://example.org/aria2`` in *delUris*. This
  2053. method returns a list which contains 2 integers. The first integer is
  2054. the number of URIs deleted. The second integer is the number of URIs
  2055. added.
  2056. The following examples add 1 URI ``http://example.org/file`` to the
  2057. file whose index is ``1`` and belongs to the download
  2058. GID#2089b05ecca3d829.
  2059. **JSON-RPC Example**
  2060. ::
  2061. >>> import urllib2, json
  2062. >>> from pprint import pprint
  2063. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2064. ... 'method':'aria2.changeUri',
  2065. ... 'params':['2089b05ecca3d829', 1, [],
  2066. ['http://example.org/file']]})
  2067. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2068. >>> pprint(json.loads(c.read()))
  2069. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [0, 1]}
  2070. **XML-RPC Example**
  2071. ::
  2072. >>> import xmlrpclib
  2073. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2074. >>> s.aria2.changeUri('2089b05ecca3d829', 1, [],
  2075. ['http://example.org/file'])
  2076. [0, 1]
  2077. .. function:: aria2.getOption(gid)
  2078. This method returns options of the download denoted by *gid*. The
  2079. response is of type struct. Its key is the name of option. The value
  2080. type is string. Note that this method does not return options which
  2081. have no default value and have not been set by the command-line
  2082. options, configuration files or RPC methods.
  2083. The following examples get options of the download
  2084. GID#2089b05ecca3d829.
  2085. **JSON-RPC Example**
  2086. ::
  2087. >>> import urllib2, json
  2088. >>> from pprint import pprint
  2089. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2090. ... 'method':'aria2.getOption',
  2091. ... 'params':['2089b05ecca3d829']})
  2092. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2093. >>> pprint(json.loads(c.read()))
  2094. {u'id': u'qwer',
  2095. u'jsonrpc': u'2.0',
  2096. u'result': {u'allow-overwrite': u'false',
  2097. u'allow-piece-length-change': u'false',
  2098. u'always-resume': u'true',
  2099. u'async-dns': u'true',
  2100. ...
  2101. **XML-RPC Example**
  2102. ::
  2103. >>> import xmlrpclib
  2104. >>> from pprint import pprint
  2105. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2106. >>> r = s.aria2.getOption('2089b05ecca3d829')
  2107. >>> pprint(r)
  2108. {'allow-overwrite': 'false',
  2109. 'allow-piece-length-change': 'false',
  2110. 'always-resume': 'true',
  2111. 'async-dns': 'true',
  2112. ....
  2113. .. function:: aria2.changeOption(gid, options)
  2114. This method changes options of the download denoted by *gid*
  2115. dynamically. *gid* is of type string. *options* is of type struct.
  2116. The following options are available for active downloads:
  2117. * :option:`bt-max-peers <--bt-max-peers>`
  2118. * :option:`bt-request-peer-speed-limit <--bt-request-peer-speed-limit>`
  2119. * :option:`bt-remove-unselected-file <--bt-remove-unselected-file>`
  2120. * :option:`force-save <--force-save>`
  2121. * :option:`max-download-limit <--max-download-limit>`
  2122. * :option:`max-upload-limit <-u>`
  2123. For waiting or paused downloads, in addition to the above options,
  2124. options listed in `Input File`_ subsection are available,
  2125. except for following options:
  2126. :option:`dry-run <--dry-run>`,
  2127. :option:`metalink-base-uri <--metalink-base-uri>`,
  2128. :option:`parameterized-uri <-P>`,
  2129. :option:`pause <--pause>`,
  2130. :option:`piece-length <--piece-length>` and
  2131. :option:`rpc-save-upload-metadata <--rpc-save-upload-metadata>` option.
  2132. This method returns ``OK`` for success.
  2133. The following examples set :option:`max-download-limit
  2134. <--max-download-limit>` option to ``20K`` for the download
  2135. GID#2089b05ecca3d829.
  2136. **JSON-RPC Example**
  2137. ::
  2138. >>> import urllib2, json
  2139. >>> from pprint import pprint
  2140. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2141. ... 'method':'aria2.changeOption',
  2142. ... 'params':['2089b05ecca3d829',
  2143. ... {'max-download-limit':'10K'}]})
  2144. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2145. >>> pprint(json.loads(c.read()))
  2146. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
  2147. **XML-RPC Example**
  2148. ::
  2149. >>> import xmlrpclib
  2150. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2151. >>> s.aria2.changeOption('2089b05ecca3d829', {'max-download-limit':'20K'})
  2152. 'OK'
  2153. .. function:: aria2.getGlobalOption()
  2154. This method returns global options. The response is of type
  2155. struct. Its key is the name of option. The value type is string.
  2156. Note that this method does not return options which have no default
  2157. value and have not been set by the command-line options, configuration
  2158. files or RPC methods. Because global options are used as a template
  2159. for the options of newly added download, the response contains keys
  2160. returned by :func:`aria2.getOption` method.
  2161. .. function:: aria2.changeGlobalOption(options)
  2162. This method changes global options dynamically. *options* is of type
  2163. struct.
  2164. The following options are available:
  2165. * :option:`download-result <--download-result>`
  2166. * :option:`log <-l>`
  2167. * :option:`log-level <--log-level>`
  2168. * :option:`max-concurrent-downloads <-j>`
  2169. * :option:`max-download-result <--max-download-result>`
  2170. * :option:`max-overall-download-limit <--max-overall-download-limit>`
  2171. * :option:`max-overall-upload-limit <--max-overall-upload-limit>`
  2172. * :option:`save-cookies <--save-cookies>`
  2173. * :option:`save-session <--save-session>`
  2174. * :option:`server-stat-of <--server-stat-of>`
  2175. In addition to them, options listed in `Input File`_ subsection
  2176. are available, except for following options:
  2177. :option:`checksum <--checksum>`,
  2178. :option:`index-out <-O>`,
  2179. :option:`out <-o>`,
  2180. :option:`pause <--pause>` and
  2181. :option:`select-file <--select-file>`.
  2182. Using :option:`log <-l>` option, you can dynamically start logging or
  2183. change log file. To stop logging, give empty string("") as a parameter
  2184. value. Note that log file is always opened in append mode. This method
  2185. returns ``OK`` for success.
  2186. .. function:: aria2.getGlobalStat()
  2187. This method returns global statistics such as overall download and
  2188. upload speed. The response is of type struct and contains following
  2189. keys. The value type is string.
  2190. ``downloadSpeed``
  2191. Overall download speed (byte/sec).
  2192. ``uploadSpeed``
  2193. Overall upload speed(byte/sec).
  2194. ``numActive``
  2195. The number of active downloads.
  2196. ``numWaiting``
  2197. The number of waiting downloads.
  2198. ``numStopped``
  2199. The number of stopped downloads.
  2200. **JSON-RPC Example**
  2201. ::
  2202. >>> import urllib2, json
  2203. >>> from pprint import pprint
  2204. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2205. ... 'method':'aria2.getGlobalStat'})
  2206. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2207. >>> pprint(json.loads(c.read()))
  2208. {u'id': u'qwer',
  2209. u'jsonrpc': u'2.0',
  2210. u'result': {u'downloadSpeed': u'21846',
  2211. u'numActive': u'2',
  2212. u'numStopped': u'0',
  2213. u'numWaiting': u'0',
  2214. u'uploadSpeed': u'0'}}
  2215. **XML-RPC Example**
  2216. ::
  2217. >>> import xmlrpclib
  2218. >>> from pprint import pprint
  2219. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2220. >>> r = s.aria2.getGlobalStat()
  2221. >>> pprint(r)
  2222. {'downloadSpeed': '23136',
  2223. 'numActive': '2',
  2224. 'numStopped': '0',
  2225. 'numWaiting': '0',
  2226. 'uploadSpeed': '0'}
  2227. .. function:: aria2.purgeDownloadResult()
  2228. This method purges completed/error/removed downloads to free memory.
  2229. This method returns ``OK``.
  2230. .. function:: aria2.removeDownloadResult(gid)
  2231. This method removes completed/error/removed download denoted by *gid*
  2232. from memory. This method returns ``OK`` for success.
  2233. The following examples remove the download result of the download
  2234. GID#2089b05ecca3d829.
  2235. **JSON-RPC Example**
  2236. ::
  2237. >>> import urllib2, json
  2238. >>> from pprint import pprint
  2239. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2240. ... 'method':'aria2.removeDownloadResult',
  2241. ... 'params':['2089b05ecca3d829']})
  2242. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2243. >>> pprint(json.loads(c.read()))
  2244. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
  2245. **XML-RPC Example**
  2246. ::
  2247. >>> import xmlrpclib
  2248. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2249. >>> s.aria2.removeDownloadResult('2089b05ecca3d829')
  2250. 'OK'
  2251. .. function:: aria2.getVersion()
  2252. This method returns version of the program and the list of enabled
  2253. features. The response is of type struct and contains following keys.
  2254. ``version``
  2255. Version number of the program in string.
  2256. ``enabledFeatures``
  2257. List of enabled features. Each feature name is of type string.
  2258. **JSON-RPC Example**
  2259. ::
  2260. >>> import urllib2, json
  2261. >>> from pprint import pprint
  2262. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2263. ... 'method':'aria2.getVersion'})
  2264. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2265. >>> pprint(json.loads(c.read()))
  2266. {u'id': u'qwer',
  2267. u'jsonrpc': u'2.0',
  2268. u'result': {u'enabledFeatures': [u'Async DNS',
  2269. u'BitTorrent',
  2270. u'Firefox3 Cookie',
  2271. u'GZip',
  2272. u'HTTPS',
  2273. u'Message Digest',
  2274. u'Metalink',
  2275. u'XML-RPC'],
  2276. u'version': u'1.11.0'}}
  2277. **XML-RPC Example**
  2278. ::
  2279. >>> import xmlrpclib
  2280. >>> from pprint import pprint
  2281. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2282. >>> r = s.aria2.getVersion()
  2283. >>> pprint(r)
  2284. {'enabledFeatures': ['Async DNS',
  2285. 'BitTorrent',
  2286. 'Firefox3 Cookie',
  2287. 'GZip',
  2288. 'HTTPS',
  2289. 'Message Digest',
  2290. 'Metalink',
  2291. 'XML-RPC'],
  2292. 'version': '1.11.0'}
  2293. .. function:: aria2.getSessionInfo()
  2294. This method returns session information.
  2295. The response is of type struct and contains following key.
  2296. ``sessionId``
  2297. Session ID, which is generated each time when aria2 is invoked.
  2298. **JSON-RPC Example**
  2299. ::
  2300. >>> import urllib2, json
  2301. >>> from pprint import pprint
  2302. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2303. ... 'method':'aria2.getSessionInfo'})
  2304. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2305. >>> pprint(json.loads(c.read()))
  2306. {u'id': u'qwer',
  2307. u'jsonrpc': u'2.0',
  2308. u'result': {u'sessionId': u'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}}
  2309. **XML-RPC Example**
  2310. ::
  2311. >>> import xmlrpclib
  2312. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2313. >>> s.aria2.getSessionInfo()
  2314. {'sessionId': 'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}
  2315. .. function:: aria2.shutdown()
  2316. This method shutdowns aria2. This method returns ``OK``.
  2317. .. function:: aria2.forceShutdown()
  2318. This method shutdowns :func:`aria2. This method behaves like aria2.shutdown`
  2319. except that any actions which takes time such as contacting BitTorrent
  2320. tracker are skipped. This method returns ``OK``.
  2321. .. function:: system.multicall(methods)
  2322. This methods encapsulates multiple method calls in a single request.
  2323. *methods* is of type array and its element is struct. The struct
  2324. contains two keys: ``methodName`` and ``params``. ``methodName`` is the
  2325. method name to call and ``params`` is array containing parameters to the
  2326. method. This method returns array of responses. The element of array
  2327. will either be a one-item array containing the return value of each
  2328. method call or struct of fault element if an encapsulated method call
  2329. fails.
  2330. In the following examples, we add 2 downloads. First one is
  2331. ``http://example.org/file`` and second one is ``file.torrent``.
  2332. **JSON-RPC Example**
  2333. ::
  2334. >>> import urllib2, json, base64
  2335. >>> from pprint import pprint
  2336. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2337. ... 'method':'system.multicall',
  2338. ... 'params':[[{'methodName':'aria2.addUri',
  2339. ... 'params':[['http://example.org']]},
  2340. ... {'methodName':'aria2.addTorrent',
  2341. ... 'params':[base64.b64encode(open('file.torrent').read())]}]]})
  2342. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2343. >>> pprint(json.loads(c.read()))
  2344. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [[u'2089b05ecca3d829'], [u'd2703803b52216d1']]}
  2345. JSON-RPC also supports Batch request described in JSON-RPC 2.0 Specification::
  2346. >>> jsonreq = json.dumps([{'jsonrpc':'2.0', 'id':'qwer',
  2347. ... 'method':'aria2.addUri',
  2348. ... 'params':[['http://example.org']]},
  2349. ... {'jsonrpc':'2.0', 'id':'asdf',
  2350. ... 'method':'aria2.addTorrent',
  2351. ... 'params':[base64.b64encode(open('file.torrent').read())]}])
  2352. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2353. >>> pprint(json.loads(c.read()))
  2354. [{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'2089b05ecca3d829'},
  2355. {u'id': u'asdf', u'jsonrpc': u'2.0', u'result': u'd2703803b52216d1'}]
  2356. **XML-RPC Example**
  2357. ::
  2358. >>> import xmlrpclib
  2359. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2360. >>> mc = xmlrpclib.MultiCall(s)
  2361. >>> mc.aria2.addUri(['http://example.org/file'])
  2362. >>> mc.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent').read()))
  2363. >>> r = mc()
  2364. >>> tuple(r)
  2365. ('2089b05ecca3d829', 'd2703803b52216d1')
  2366. Error Handling
  2367. ~~~~~~~~~~~~~~
  2368. In JSON-RPC, aria2 returns JSON object which contains error code in
  2369. code and the error message in message.
  2370. In XML-RPC, aria2 returns faultCode=1 and the error message in
  2371. faultString.
  2372. .. _rpc_options:
  2373. Options
  2374. ~~~~~~~
  2375. Same options for :option:`--input-file <-i>` list are available. See `Input File`_ subsection for complete list of options.
  2376. In the option struct, name element is option name(without preceding
  2377. ``--``) and value element is argument as string.
  2378. JSON-RPC Example
  2379. ^^^^^^^^^^^^^^^^
  2380. ::
  2381. {'split':'1', 'http-proxy':'http://proxy/'}
  2382. XML-RPC Example
  2383. ^^^^^^^^^^^^^^^
  2384. .. code-block:: xml
  2385. <struct>
  2386. <member>
  2387. <name>split</name>
  2388. <value><string>1</string></value>
  2389. </member>
  2390. <member>
  2391. <name>http-proxy</name>
  2392. <value><string>http://proxy/</string></value>
  2393. </member>
  2394. </struct>
  2395. :option:`header <--header>` and :option:`index-out <-O>`
  2396. option are allowed multiple times in
  2397. command-line. Since name should be unique in struct(many XML-RPC
  2398. library implementation uses hash or dict for struct), single string is
  2399. not enough. To overcome this situation, they can take array as value
  2400. as well as string.
  2401. JSON-RPC Example
  2402. ^^^^^^^^^^^^^^^^
  2403. ::
  2404. {'header':['Accept-Language: ja', 'Accept-Charset: utf-8']}
  2405. XML-RPC Example
  2406. ^^^^^^^^^^^^^^^
  2407. .. code-block:: xml
  2408. <struct>
  2409. <member>
  2410. <name>header</name>
  2411. <value>
  2412. <array>
  2413. <data>
  2414. <value><string>Accept-Language: ja</string></value>
  2415. <value><string>Accept-Charset: utf-8</string></value>
  2416. </data>
  2417. </array>
  2418. </value>
  2419. </member>
  2420. </struct>
  2421. Following example adds a download with 2 options: dir and header.
  2422. header option has 2 values, so it uses a list::
  2423. >>> import xmlrpclib
  2424. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2425. >>> opts = dict(dir='/tmp',
  2426. ... header=['Accept-Language: ja',
  2427. ... 'Accept-Charset: utf-8'])
  2428. >>> s.aria2.addUri(['http://example.org/file'], opts)
  2429. '1'
  2430. JSON-RPC using HTTP GET
  2431. ~~~~~~~~~~~~~~~~~~~~~~~
  2432. The JSON-RPC interface also supports request via HTTP GET.
  2433. The encoding scheme in GET parameters is based on JSON-RPC over HTTP Specification [2008-1-15(RC1)].
  2434. The encoding of GET parameters are follows::
  2435. /jsonrpc?method=METHOD_NAME&id=ID&params=BASE64_ENCODED_PARAMS
  2436. The ``method`` and ``id`` are always treated as JSON string and their
  2437. encoding must be UTF-8.
  2438. For example, The encoded string of
  2439. ``aria2.tellStatus('2089b05ecca3d829')`` with ``id='foo'`` looks like
  2440. this::
  2441. /jsonrpc?method=aria2.tellStatus&id=foo&params=WyIyMDg5YjA1ZWNjYTNkODI5Il0%3D
  2442. The ``params`` parameter is Base64-encoded JSON array which usually
  2443. appears in ``params`` attribute in JSON-RPC request object. In the
  2444. above example, the params is ``["2089b05ecca3d829"]``, therefore::
  2445. ["2089b05ecca3d829"] --(Base64)--> WyIyMDg5YjA1ZWNjYTNkODI5Il0=
  2446. --(Percent Encode)--> WyIyMDg5YjA1ZWNjYTNkODI5Il0%3D
  2447. The JSON-RPC interface supports JSONP. You can specify the callback
  2448. function in ``jsoncallback`` parameter::
  2449. /jsonrpc?method=aria2.tellStatus&id=foo&params=WyIyMDg5YjA1ZWNjYTNkODI5Il0%3D&jsoncallback=cb
  2450. For Batch request, ``method`` and ``id`` parameter must not be specified.
  2451. Whole request must be specified in ``params`` parameter. For example,
  2452. Batch request::
  2453. [{'jsonrpc':'2.0', 'id':'qwer', 'method':'aria2.getVersion'},
  2454. {'jsonrpc':'2.0', 'id':'asdf', 'method':'aria2.tellActive'}]
  2455. will be encoded like this::
  2456. /jsonrpc?params=W3sianNvbnJwYyI6ICIyLjAiLCAiaWQiOiAicXdlciIsICJtZXRob2QiOiAiYXJpYTIuZ2V0VmVyc2lvbiJ9LCB7Impzb25ycGMiOiAiMi4wIiwgImlkIjogImFzZGYiLCAibWV0aG9kIjogImFyaWEyLnRlbGxBY3RpdmUifV0%3D
  2457. JSON-RPC over WebSocket
  2458. ~~~~~~~~~~~~~~~~~~~~~~~
  2459. JSON-RPC over WebSocket uses same method signatures and response
  2460. format with JSON-RPC over HTTP. The supported WebSocket version is 13
  2461. which is detailed in :rfc:`6455`.
  2462. To send a RPC request to the RPC server, send serialized JSON string
  2463. in Text frame. The response from the RPC server is delivered also in
  2464. Text frame.
  2465. The RPC server will send the notification to the client. The
  2466. notification is unidirectional, therefore the client which received
  2467. the notification must not respond to it. The method signature of
  2468. notification is much like a normal method request but lacks id
  2469. key. The value associated by the params key is the data which this
  2470. notification carries. The format of this value varies depending on the
  2471. notification method. Following notification methods are defined.
  2472. .. function:: aria2.onDownloadStart(event)
  2473. This notification will be sent if a download is started.
  2474. The *event* is of type struct and it contains following keys.
  2475. The value type is string.
  2476. ``gid``
  2477. GID of the download.
  2478. .. function:: aria2.onDownloadPause(event)
  2479. This notification will be sent if a download is paused. The *event*
  2480. is the same struct of the *event* argument of
  2481. :func:`aria2.onDownloadStart` method.
  2482. .. function:: aria2.onDownloadStop(event)
  2483. This notification will be sent if a download is stopped by the user.
  2484. The *event* is the same struct of the *event* argument of
  2485. :func:`aria2.onDownloadStart` method.
  2486. .. function:: aria2.onDownloadComplete(event)
  2487. This notification will be sent if a download is completed. In
  2488. BitTorrent downloads, this notification is sent when the download is
  2489. completed and seeding is over. The *event* is the same struct of the
  2490. *event* argument of
  2491. :func:`aria2.onDownloadStart` method.
  2492. .. function:: aria2.onDownloadError(event)
  2493. This notification will be sent if a download is stopped due to error.
  2494. The *event* is the same struct of the *event* argument of
  2495. :func:`aria2.onDownloadStart` method.
  2496. .. function:: aria2.onBtDownloadComplete(event)
  2497. This notification will be sent if a download is completed in
  2498. BitTorrent (but seeding may not be over). The *event* is the same struct
  2499. of the *event* argument of
  2500. :func:`aria2.onDownloadStart` method.
  2501. Sample XML-RPC Client Code
  2502. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  2503. The following Ruby script adds ``http://localhost/aria2.tar.bz2`` to
  2504. aria2c operated on localhost with option :option:`--dir=/downloads <-d>` and
  2505. prints its reponse:
  2506. .. code-block:: ruby
  2507. #!/usr/bin/env ruby
  2508. require 'xmlrpc/client'
  2509. require 'pp'
  2510. client=XMLRPC::Client.new2("http://localhost:6800/rpc")
  2511. options={ "dir" => "/downloads" }
  2512. result=client.call("aria2.addUri", [ "http://localhost/aria2.tar.bz2" ], options)
  2513. pp result
  2514. If you are a Python lover, you can use xmlrpclib(for Python3.x, use
  2515. xmlrpc.client instead) to interact with aria2::
  2516. import xmlrpclib
  2517. from pprint import pprint
  2518. s = xmlrpclib.ServerProxy("http://localhost:6800/rpc")
  2519. r = s.aria2.addUri(["http://localhost/aria2.tar.bz2"], {"dir":"/downloads"})
  2520. pprint(r)
  2521. MISC
  2522. ----
  2523. Console Readout
  2524. ~~~~~~~~~~~~~~~
  2525. While downloading files, aria2 prints the console readout to tell the
  2526. progress of the downloads. The console readout is like this::
  2527. [#2089b0 400.0KiB/33.2MiB(1%) CN:1 DL:115.7KiB ETA:4m51s]
  2528. This section describes what these numbers and strings mean.
  2529. ``#NNNNNN``
  2530. The first 6 characters of GID in hex string. GID is an unique ID for
  2531. each download.
  2532. ``X/Y(Z%)``
  2533. Completed length, the total file length and its ratio. If
  2534. :option:`--select-file` is used, this is the sum of selected file.
  2535. ``SEED``
  2536. Share ratio. The client is now seeding. After BitTorrent download
  2537. finished, size information is replaced with this.
  2538. ``CN``
  2539. The number of connections the client has established.
  2540. ``SD``
  2541. The number of seeders the client is now connecting to.
  2542. ``DL``
  2543. Download speed (bytes per second).
  2544. ``UL``
  2545. Upload speed (bytes per second) and the number of uploaded bytes.
  2546. ``ETA``
  2547. Expected time to finish.
  2548. When more than 1 download are going on, some of the information
  2549. described above will be omitted in order to show several download
  2550. information. And the overall download and upload speed are shown at
  2551. the beginning of the line.
  2552. When aria2 is allocating file space or validating checksum, it
  2553. additionally prints the their progress:
  2554. FileAlloc
  2555. GID, allocated length and total length in bytes.
  2556. Checksum
  2557. GID, validated length and total length in bytes.
  2558. EXAMPLE
  2559. -------
  2560. HTTP/FTP Segmented Download
  2561. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2562. Download a file
  2563. ^^^^^^^^^^^^^^^
  2564. .. code-block:: console
  2565. $ aria2c "http://host/file.zip"
  2566. .. note::
  2567. To stop a download, press :kbd:`Ctrl-C`. You can resume the transfer by running aria2c with the same argument in the same directory. You can change URIs as long as they are pointing to the same file.
  2568. Download a file from 2 different HTTP servers
  2569. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2570. .. code-block:: console
  2571. $ aria2c "http://host/file.zip" "http://mirror/file.zip"
  2572. Download a file from 1 host using 2 connections
  2573. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2574. .. code-block:: console
  2575. $ aria2c -x2 -k1M "http://host/file.zip"
  2576. Download a file from HTTP and FTP servers
  2577. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2578. .. code-block:: console
  2579. $ aria2c "http://host1/file.zip" "ftp://host2/file.zip"
  2580. Download files listed in a text file concurrently
  2581. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2582. .. code-block:: console
  2583. $ aria2c -ifiles.txt -j2
  2584. .. note::
  2585. -j option specifies the number of parallel downloads.
  2586. Using proxy
  2587. ^^^^^^^^^^^
  2588. For HTTP:
  2589. .. code-block:: console
  2590. $ aria2c --http-proxy="http://proxy:8080" "http://host/file"
  2591. .. code-block:: console
  2592. $ aria2c --http-proxy="http://proxy:8080" --no-proxy="localhost,127.0.0.1,192.168.0.0/16" "http://host/file"
  2593. For FTP:
  2594. .. code-block:: console
  2595. $ aria2c --ftp-proxy="http://proxy:8080" "ftp://host/file"
  2596. .. note::
  2597. See :option:`--http-proxy`, :option:`--https-proxy`, :option:`--ftp-proxy`, :option:`--all-proxy` and
  2598. :option:`--no-proxy` for details. You can specify proxy in the environment
  2599. variables. See `ENVIRONMENT`_ section.
  2600. Proxy with authorization
  2601. ^^^^^^^^^^^^^^^^^^^^^^^^
  2602. .. code-block:: console
  2603. $ aria2c --http-proxy="http://username:password@proxy:8080" "http://host/file"
  2604. .. code-block:: console
  2605. $ aria2c --http-proxy="http://proxy:8080" --http-proxy-user="username" --http-proxy-passwd="password" "http://host/file"
  2606. Metalink Download
  2607. ~~~~~~~~~~~~~~~~~
  2608. Download files with remote Metalink
  2609. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2610. .. code-block:: console
  2611. $ aria2c --follow-metalink=mem "http://host/file.metalink"
  2612. Download using a local metalink file
  2613. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2614. .. code-block:: console
  2615. $ aria2c -p --lowest-speed-limit=4000 file.metalink
  2616. .. note::
  2617. To stop a download, press :kbd:`Ctrl-C`.
  2618. You can resume the transfer by running aria2c with the same argument in the same
  2619. directory.
  2620. Download several local metalink files
  2621. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2622. .. code-block:: console
  2623. $ aria2c -j2 file1.metalink file2.metalink
  2624. Download only selected files using index
  2625. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2626. .. code-block:: console
  2627. $ aria2c --select-file=1-4,8 file.metalink
  2628. .. note::
  2629. The index is printed to the console using -S option.
  2630. Download a file using a local metalink file with user preference
  2631. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2632. .. code-block:: console
  2633. $ aria2c --metalink-location=jp,us --metalink-version=1.1 --metalink-language=en-US file.metalink
  2634. BitTorrent Download
  2635. ~~~~~~~~~~~~~~~~~~~
  2636. Download files from remote BitTorrent file
  2637. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2638. .. code-block:: console
  2639. $ aria2c --follow-torrent=mem "http://host/file.torrent"
  2640. Download using a local torrent file
  2641. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2642. .. code-block:: console
  2643. $ aria2c --max-upload-limit=40K file.torrent
  2644. .. note::
  2645. --max-upload-limit specifies the max of upload rate.
  2646. .. note::
  2647. To stop a download, press :kbd:`Ctrl-C`. You can resume the transfer by running aria2c with the same argument in the same directory.
  2648. Download using BitTorrent Magnet URI
  2649. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2650. .. code-block:: console
  2651. $ aria2c "magnet:?xt=urn:btih:248D0A1CD08284299DE78D5C1ED359BB46717D8C&dn=aria2"
  2652. .. note::
  2653. Don't forget to quote BitTorrent Magnet URI which includes ``&``
  2654. character with single(``'``) or double(``"``) quotation.
  2655. Download 2 torrents
  2656. ^^^^^^^^^^^^^^^^^^^
  2657. .. code-block:: console
  2658. $ aria2c -j2 file1.torrent file2.torrent
  2659. Download a file using torrent and HTTP/FTP server
  2660. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2661. .. code-block:: console
  2662. $ aria2c -Ttest.torrent "http://host1/file" "ftp://host2/file"
  2663. .. note::
  2664. Downloading multi file torrent with HTTP/FTP is not supported.
  2665. Download only selected files using index(usually called "selectable download")
  2666. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2667. .. code-block:: console
  2668. $ aria2c --select-file=1-4,8 file.torrent
  2669. .. note::
  2670. The index is printed to the console using -S option.
  2671. Specify output filename
  2672. ^^^^^^^^^^^^^^^^^^^^^^^
  2673. To specify output filename for BitTorrent downloads, you need to know
  2674. the index of file in torrent file using :option:`--show-files <-S>` option. For example, the
  2675. output looks like this::
  2676. idx|path/length
  2677. ===+======================
  2678. 1|dist/base-2.6.18.iso
  2679. |99.9MiB
  2680. ---+----------------------
  2681. 2|dist/driver-2.6.18.iso
  2682. |169.0MiB
  2683. ---+----------------------
  2684. To save 'dist/base-2.6.18.iso' in '/tmp/mydir/base.iso' and
  2685. 'dist/driver-2.6.18.iso' in '/tmp/dir/driver.iso', use the following
  2686. command:
  2687. .. code-block:: console
  2688. $ aria2c --dir=/tmp --index-out=1=mydir/base.iso --index-out=2=dir/driver.iso file.torrent
  2689. Change the listening port for incoming peer
  2690. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2691. .. code-block:: console
  2692. $ aria2c --listen-port=7000-7001,8000 file.torrent
  2693. .. note::
  2694. Since aria2 doesn't configure firewall or router for port forwarding, it's up
  2695. to you to do it manually.
  2696. Specify the condition to stop program after torrent download finished
  2697. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2698. .. code-block:: console
  2699. $ aria2c --seed-time=120 --seed-ratio=1.0 file.torrent
  2700. .. note::
  2701. In the above example, the program exits when the 120 minutes has elapsed since download completed or seed ratio reaches 1.0.
  2702. Throttle upload speed
  2703. ^^^^^^^^^^^^^^^^^^^^^
  2704. .. code-block:: console
  2705. $ aria2c --max-upload-limit=100K file.torrent
  2706. Enable IPv4 DHT
  2707. ^^^^^^^^^^^^^^^
  2708. .. code-block:: console
  2709. $ aria2c --enable-dht --dht-listen-port=6881 file.torrent
  2710. .. note::
  2711. DHT uses udp port. Since aria2 doesn't configure firewall or router for port
  2712. forwarding, it's up to you to do it manually.
  2713. Enable IPv6 DHT
  2714. ^^^^^^^^^^^^^^^
  2715. .. code-block:: console
  2716. $ aria2c --enable-dht6 --dht-listen-port=6881 --dht-listen-addr6=YOUR_GLOBAL_UNICAST_IPV6_ADDR --enable-async-dns6
  2717. .. note::
  2718. If aria2c is not built with c-ares, :option:`--enable-async-dns6` is
  2719. unnecessary. aria2 shares same port between IPv4 and IPv6 DHT.
  2720. Add and remove tracker URI
  2721. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  2722. Removes all tracker announce URIs described in file.torrent and use
  2723. ``http://tracker1/announce`` and ``http://tracker2/announce`` instead:
  2724. .. code-block:: console
  2725. $ aria2c --bt-exclude-tracker="*" --bt-tracker="http://tracker1/announce,http://tracker2/announce" file.torrent
  2726. More advanced HTTP features
  2727. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2728. Load cookies
  2729. ^^^^^^^^^^^^
  2730. .. code-block:: console
  2731. $ aria2c --load-cookies=cookies.txt "http://host/file.zip"
  2732. .. note::
  2733. You can use Firefox/Mozilla/Chromium's cookie file without modification.
  2734. Resume download started by web browsers or another programs
  2735. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2736. .. code-block:: console
  2737. $ aria2c -c -s2 "http://host/partiallydownloadedfile.zip"
  2738. Client certificate authorization for SSL/TLS
  2739. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2740. .. code-block:: console
  2741. $ aria2c --certificate=/path/to/mycert.pem --private-key=/path/to/mykey.pem https://host/file
  2742. .. note::
  2743. The file specified in :option:`--private-key` must be decrypted. The behavior when
  2744. encrypted one is given is undefined.
  2745. Verify peer in SSL/TLS using given CA certificates
  2746. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2747. .. code-block:: console
  2748. $ aria2c --ca-certificate=/path/to/ca-certificates.crt --check-certificate https://host/file
  2749. RPC
  2750. ~~~
  2751. Encrypt RPC transport by SSL/TLS
  2752. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2753. Specify server certificate file and private key file as follows:
  2754. .. code-block:: console
  2755. $ aria2c --enable-rpc --rpc-certificate=/path/to/server.crt --rpc-private-key=/path/to/server.key --rpc-secure
  2756. And more advanced features
  2757. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  2758. Throttle download speed
  2759. ^^^^^^^^^^^^^^^^^^^^^^^
  2760. .. code-block:: console
  2761. $ aria2c --max-download-limit=100K file.metalink
  2762. Repair a damaged download
  2763. ^^^^^^^^^^^^^^^^^^^^^^^^^
  2764. .. code-block:: console
  2765. $ aria2c -V file.metalink
  2766. .. note::
  2767. Repairing damaged downloads can be done efficiently when used with
  2768. BitTorrent or Metalink with chunk checksums.
  2769. Drop connection if download speed is lower than specified value
  2770. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2771. .. code-block:: console
  2772. $ aria2c --lowest-speed-limit=10K file.metalink
  2773. Parameterized URI support
  2774. ^^^^^^^^^^^^^^^^^^^^^^^^^
  2775. You can specify set of parts:
  2776. .. code-block:: console
  2777. $ aria2c -P "http://{host1,host2,host3}/file.iso"
  2778. You can specify numeric sequence:
  2779. .. code-block:: console
  2780. $ aria2c -Z -P "http://host/image[000-100].png"
  2781. .. note::
  2782. -Z option is required if the all URIs don't point to the same file, such as the above example.
  2783. You can specify step counter:
  2784. .. code-block:: console
  2785. $ aria2c -Z -P "http://host/image[A-Z:2].png"
  2786. Verify checksum
  2787. ^^^^^^^^^^^^^^^
  2788. .. code-block:: console
  2789. $ aria2c --checksum=sha-1=0192ba11326fe2298c8cb4de616f4d4140213837 http://example.org/file
  2790. Parallel downloads of arbitrary number of URI,metalink,torrent
  2791. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2792. .. code-block:: console
  2793. $ aria2c -j3 -Z "http://host/file1" file2.torrent file3.metalink
  2794. BitTorrent Encryption
  2795. ^^^^^^^^^^^^^^^^^^^^^
  2796. Encrypt whole payload using ARC4:
  2797. .. code-block:: console
  2798. $ aria2c --bt-min-crypto-level=arc4 --bt-require-crypto=true file.torrent
  2799. SEE ALSO
  2800. --------
  2801. Project Web Site: http://aria2.sourceforge.net/
  2802. aria2 Wiki: http://sourceforge.net/apps/trac/aria2/wiki
  2803. Metalink Homepage: http://www.metalinker.org/
  2804. The Metalink Download Description Format: :rfc:`5854`
  2805. COPYRIGHT
  2806. ---------
  2807. Copyright (C) 2006, 2012 Tatsuhiro Tsujikawa
  2808. This program is free software; you can redistribute it and/or modify
  2809. it under the terms of the GNU General Public License as published by
  2810. the Free Software Foundation; either version 2 of the License, or
  2811. (at your option) any later version.
  2812. This program is distributed in the hope that it will be useful,
  2813. but WITHOUT ANY WARRANTY; without even the implied warranty of
  2814. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2815. GNU General Public License for more details.
  2816. You should have received a copy of the GNU General Public License
  2817. along with this program; if not, write to the Free Software
  2818. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  2819. In addition, as a special exception, the copyright holders give
  2820. permission to link the code of portions of this program with the
  2821. OpenSSL library under certain conditions as described in each
  2822. individual source file, and distribute linked combinations
  2823. including the two.
  2824. You must obey the GNU General Public License in all respects
  2825. for all of the code used other than OpenSSL. If you modify
  2826. file(s) with this exception, you may extend this exception to your
  2827. version of the file(s), but you are not obligated to do so. If you
  2828. do not wish to do so, delete this exception statement from your
  2829. version. If you delete this exception statement from all source
  2830. files in the program, then also delete it here.