comparison doc/jp/file.rst @ 3041:72583524cfd3

doc (jp): jp commands are now fully documented: rel 232
author Goffi <goffi@goffi.org>
date Tue, 01 Oct 2019 22:49:06 +0200
parents
children c3cb18236bdf
comparison
equal deleted inserted replaced
3040:fee60f17ebac 3041:72583524cfd3
1 ========================================
2 file: files sending/receiving/management
3 ========================================
4
5 ``file`` group all commands related to file management, and allows you to send easily a
6 file to a contact or device from the command line.
7
8 send
9 ====
10
11 Send a file to a contact.
12
13 The file will be sent using best available method (which is Jingle File Transfer when
14 available), and will try to send the file in P2P when possible. If P2P is possible, the
15 signal is sent through the server (metadata, negotiation, etc.), while the file itself
16 goes directly from the source device to the target device. When P2P is not possible, the
17 file may go through the server or an other one (if a proxy is used for instance).
18
19 When sending a file, you specify one or more file(s) to send, and the either the bare jid
20 or the full jid of the target device. If bare jid is specified, the main resource will be
21 used.
22
23 You'll usually want to see the progression of the transfer, use ``-P, --progress`` for
24 that.
25
26 If you send several files at once, you may want to use ``-b, --bz2`` to group them in a
27 single compressed ``tar.bz2`` archive (the client receiving the files will then receive a
28 single file, than the user can then decompress).
29
30 By default the name of the source file is used, but you use ``-n NAME, --name NAME`` to
31 specify another one.
32
33 The path and namespace (set with ``-d PATH, --path PATH`` and ``-N NAMESPACE, --namespace
34 NAMESPACE``) are non-standard metadata used by SàT to organise files (``PATH`` being like
35 a file path on locale file system, and ``NAMESPACE`` being a name to associate to a group
36 of files, for instance for a photo album).
37
38 examples
39 --------
40
41 Send a file to Louise, with a progress bar::
42
43 $ jp file send -P some_file.ext louise@example.org
44
45 Send a picture to a file sharing component, putting it in the ``holidays`` namespace, in
46 the ``/some/path`` path::
47
48 $ jp file send -P -N holidays -d /some/path some_photo.jpg files.example.org
49
50 .. _jp-file_request:
51
52 request
53 =======
54
55 Ask to get a file from a device/sharing service. A file is requested using one or more
56 metadata, which can be the file name (with ``-n NAME, --name NAME``), its hash (with ``-H
57 HASH, --hash HASH`` and the algorithm may be specified with ``-a HASH_ALGO, --hash-algo
58 HASH_ALGO``), its path (with ``-d PATH, --path PATH``) and its namespace (with ``-N
59 NAMESPACE, --namespace NAMESPACE``). Note that ``PATH`` and ``NAMESPACE`` are SàT specific
60 and not (yet?) XMPP standards.
61
62 If you already know the hash, it's the most efficient and recommended way to retrieve a
63 file.
64
65 You need to specify the full jid of the device or the sharing service as a positional
66 argument.
67
68 By default the file is downloaded in current directory, but you can specify an other one
69 (and an other filename) with ``-D DEST, --dest DEST``.
70
71 If you want to see progression of the transfer, use ``-P, --progress``.
72
73 examples
74 --------
75
76 Request a file names ``some_file.jpg`` in path ``/photos/demo_album`` at service
77 ``files.example.org``, with a progress bar::
78
79 $ jp file request -P -d photos/demo_album -n some_file.jpg files.example.org
80
81 Request file with given ``sha-256`` hash (which is default hash algorithm, so we don't
82 specify it), and save it to file ``dest_file.txt``::
83
84 $ jp file request -H f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2 -D dest_file.txt files.example.org
85
86 receive
87 =======
88
89 Wait for a file (or several ones) to be received, and accept it if it match criteria.
90
91 You should specify which jid you are expecting a file from, using the positional
92 arguments. If you don't, all files will be accepted, which can be dangerous if some
93 malicious user send you a file at this moment.
94
95 To see progression (this is recommended), you can use the ``-P, --progress`` options.
96
97 By default, if a file with the same name as the proposed one exists, the transfer will be
98 denied. You can override this behaviour with ``-f, --force``, but be sure to absolutely
99 trust the sender in this case, as the name is chosen by her, and could be malicious, or it
100 could override an important file.
101
102 If you expect several files, you can use the ``-m, --multiple``, in this case the command
103 won't stop after the file received file, and you'll have to manually stop it with
104 ``Ctrl-C`` or by sending a ``SIGTERM``.
105
106 File(s) will be written in the current directory, but you may specify an other destination
107 with ``--path DIR``.
108
109 examples
110 --------
111
112 Accept and receive the next file, save it to local directory and show a progress bar::
113
114 $ jp file receive --progress
115
116 Several files are expected from Louise, accept them and store them do
117 ``~/Downloads/Louise``::
118
119 $ jp file receive --multiple --path ~/Downloads/Louise louise@example.org
120
121
122 upload
123 ======
124
125 Upload a file to your XMPP server (or an other entity if specified). The upload will be
126 done using `XEP-0363 (HTTP File Upload)`_, and the public URL to retrieve the file will be
127 printed. Note that anybody knowing this URL can download the file you've uploaded.
128
129 The path to the file to upload is expected as first argument, then optionally the entity
130 of the service to upload too (by default, this is autodetected if your server offers this
131 feature).
132
133 As usual, you can use ``-P, --progress`` to see a progress bar.
134
135 .. _XEP-0363 (HTTP File Upload): XEP-0363: HTTP File Upload
136
137 example
138 -------
139
140 Upload a document to a server::
141
142 $ jp file upload -P ~/Documents/something_interesting.odt
143
144 share
145 =====
146
147 Subcommands for advanced file sharing. Please check :ref:`jp-file_share`.