mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
ftp-client: Add `ftp-size'.
* guix/ftp-client.scm (ftp-size): New procedure.
This commit is contained in:
parent
a9f8b72ee1
commit
fb83842efb
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2010, 2011, 2012 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2010, 2011, 2012, 2013 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -33,6 +33,7 @@ (define-module (guix ftp-client)
|
|||
ftp-open
|
||||
ftp-close
|
||||
ftp-chdir
|
||||
ftp-size
|
||||
ftp-list
|
||||
ftp-retr))
|
||||
|
||||
|
@ -133,6 +134,12 @@ (define (ftp-chdir conn dir)
|
|||
(%ftp-command (string-append "CWD " dir) 250
|
||||
(ftp-connection-socket conn)))
|
||||
|
||||
(define (ftp-size conn file)
|
||||
"Return the size in bytes of FILE."
|
||||
(let ((message (%ftp-command (string-append "SIZE " file) 213
|
||||
(ftp-connection-socket conn))))
|
||||
(string->number (string-trim-both message))))
|
||||
|
||||
(define (ftp-pasv conn)
|
||||
(define %pasv-rx
|
||||
(make-regexp "([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+),([0-9]+)"))
|
||||
|
|
Loading…
Reference in a new issue