FTP: Difference between revisions

904 bytes added ,  9 years ago
Added zkl
(Added zkl)
Line 246:
}
</lang>
 
=={{header|zkl}}==
Using the cURL library, doing this from the REPL. Moving around in the tree isn't supported.
<lang zkl>zkl: var cURL=Import("zklCurl")
zkl: var d=cURL().get("ftp.hq.nasa.gov/pub/issoutreach/Living in Space Stories (MP3 Files)/")
L(Data(2,567),1630,23) // downloaded listing, 1630 bytes of header, 23 bytes of trailer
zkl: d[0][1630,-23].text
-rw-rw-r-- 1 109 space-station 2327118 May 9 2005 09sept_spacepropulsion.mp3
...
-rw-rw-r-- 1 109 space-station 1134654 May 9 2005 When Space Makes you Dizzy.mp3
 
zkl: d=cURL().get("ftp.hq.nasa.gov/pub/issoutreach/Living in Space Stories (MP3 Files)/When Space Makes you Dizzy.mp3")
L(Data(1,136,358),1681,23)
zkl: File("foo.mp3","w").write(d[0][1681,-23])
1134654 // note that this matches size in listing</lang>
The resulting file foo.mp3 has a nice six minute description of what can happen when returning from space.
Anonymous user