From acd25281bfa31b78fd03e25b495f66138a4dd987 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 17 Dec 2010 18:56:15 +0000 Subject: [PATCH] docs: Add section on using /dev/fd/* with upload and download calls. --- src/guestfs.pod | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/guestfs.pod b/src/guestfs.pod index bb90de8..7d2f91c 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -334,6 +334,27 @@ Use L. See L above. =back +=head2 UPLOADING AND DOWNLOADING TO PIPES AND FILE DESCRIPTORS + +Calls like L, L, +L, L etc appear to only take +filenames as arguments, so it appears you can only upload and download +to files. However many Un*x-like hosts let you use the special device +files C, C, C and C +to read and write from stdin, stdout, stderr, and arbitrary file +descriptor N. + +For example, L writes its output to stdout by +doing: + + guestfs_download (filename, "/dev/stdout"); + +and you can write tar output to a pipe C by doing: + + char devfd[64]; + snprintf (devfd, sizeof devfd, "/dev/fd/%d", fd); + guestfs_tar_out ("/", devfd); + =head2 LISTING FILES L is just designed for humans to read (mainly when using -- 1.8.3.1