@sumaris-net/ngx-components 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/doc/changelog.md +3 -0
- package/esm2020/src/app/core/form/form.utils.mjs +1 -2
- package/esm2020/src/app/core/table/table.class.mjs +3 -3
- package/esm2020/src/app/shared/dates.mjs +2 -2
- package/fesm2015/sumaris-net.ngx-components.mjs +3 -4
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +3 -4
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/README.md +5 -6
- package/src/app/core/form/form.utils.d.ts +0 -1
- package/src/app/core/table/table.class.d.ts +3 -1
- package/plugins/clovelced-plugin-audiomanagement/README.md +0 -66
- package/plugins/cordova-plugin-camera/README.md +0 -703
- package/plugins/cordova-plugin-device/README.md +0 -309
- package/plugins/cordova-plugin-file/README.md +0 -848
- package/plugins/cordova-plugin-file-transfer/README.md +0 -598
- package/plugins/cordova-plugin-file-transfer/doc/de/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/es/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/fr/README.md +0 -270
- package/plugins/cordova-plugin-file-transfer/doc/it/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/ja/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/ko/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/pl/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/zh/README.md +0 -311
- package/plugins/cordova-plugin-ionic-keyboard/README.md +0 -220
- package/plugins/cordova-plugin-ionic-webview/README.md +0 -181
- package/plugins/cordova-plugin-media-capture/README.md +0 -626
- package/plugins/cordova-plugin-splashscreen/README.md +0 -387
- package/plugins/cordova-plugin-statusbar/README.md +0 -341
- package/plugins/cordova-plugin-telerik-imagepicker/README.md +0 -155
- package/plugins/cordova-plugin-whitelist/README.md +0 -185
- package/plugins/cordova-sqlite-storage/README.md +0 -1848
- package/plugins/integrator-cordova-plugin-downloader/README.md +0 -49
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
# license: Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
|
4
|
-
# distributed with this work for additional information
|
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
|
7
|
-
# "License"); you may not use this file except in compliance
|
|
8
|
-
# with the License. You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
|
13
|
-
# software distributed under the License is distributed on an
|
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
# KIND, either express or implied. See the License for the
|
|
16
|
-
# specific language governing permissions and limitations
|
|
17
|
-
# under the License.
|
|
18
|
-
-->
|
|
19
|
-
|
|
20
|
-
# cordova-plugin-file-transfer
|
|
21
|
-
|
|
22
|
-
[](https://travis-ci.org/apache/cordova-plugin-file-transfer)
|
|
23
|
-
|
|
24
|
-
Documentation du plugin : <doc/index.md>
|
|
25
|
-
|
|
26
|
-
Ce plugin vous permet de télécharger des fichiers.
|
|
27
|
-
|
|
28
|
-
Ce plugin définit global `FileTransfer` , `FileUploadOptions` constructeurs.
|
|
29
|
-
|
|
30
|
-
Bien que dans la portée globale, ils ne sont pas disponibles jusqu'après la `deviceready` événement.
|
|
31
|
-
|
|
32
|
-
document.addEventListener (« deviceready », onDeviceReady, false) ;
|
|
33
|
-
function onDeviceReady() {console.log(FileTransfer);}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## Installation
|
|
37
|
-
|
|
38
|
-
cordova plugin add cordova-plugin-file-transfer
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Plates-formes supportées
|
|
42
|
-
|
|
43
|
-
* Amazon Fire OS
|
|
44
|
-
* Android
|
|
45
|
-
* BlackBerry 10
|
|
46
|
-
* Navigateur
|
|
47
|
-
* Firefox OS **
|
|
48
|
-
* iOS
|
|
49
|
-
* Windows Phone 7 et 8 *
|
|
50
|
-
* Windows 8
|
|
51
|
-
* Windows
|
|
52
|
-
|
|
53
|
-
\ * *Ne supportent pas `onprogress` ni `abort()` *
|
|
54
|
-
|
|
55
|
-
\ ** *Ne prennent pas en charge les `onprogress` *
|
|
56
|
-
|
|
57
|
-
# Transfert de fichiers
|
|
58
|
-
|
|
59
|
-
L'objet de `FileTransfer` fournit un moyen de télécharger des fichiers à l'aide d'une requête HTTP multi-part POST ou PUT et pour télécharger des fichiers.
|
|
60
|
-
|
|
61
|
-
## Propriétés
|
|
62
|
-
|
|
63
|
-
* **onprogress** : fonction appelée avec un `ProgressEvent` à chaque fois qu'un nouveau segment de données est transféré. *(Function)*
|
|
64
|
-
|
|
65
|
-
## Méthodes
|
|
66
|
-
|
|
67
|
-
* **upload** : envoie un fichier à un serveur.
|
|
68
|
-
|
|
69
|
-
* **download** : télécharge un fichier depuis un serveur.
|
|
70
|
-
|
|
71
|
-
* **abort** : annule le transfert en cours.
|
|
72
|
-
|
|
73
|
-
## upload
|
|
74
|
-
|
|
75
|
-
**Paramètres**:
|
|
76
|
-
|
|
77
|
-
* **fileURL** : système de fichiers URL représentant le fichier sur le périphérique. Pour la compatibilité ascendante, cela peut aussi être le chemin complet du fichier sur le périphérique. (Voir [Backwards Compatibility Notes] ci-dessous)
|
|
78
|
-
|
|
79
|
-
* **server** : l'URL du serveur destiné à recevoir le fichier, encodée via `encodeURI()`.
|
|
80
|
-
|
|
81
|
-
* **successCallback**: un rappel passé un `FileUploadResult` objet. *(Fonction)*
|
|
82
|
-
|
|
83
|
-
* **errorCallback**: un rappel qui s'exécute si une erreur survient récupérer la `FileUploadResult` . Appelée avec un `FileTransferError` objet. *(Fonction)*
|
|
84
|
-
|
|
85
|
-
* **options**: paramètres facultatifs *(objet)*. Clés valides :
|
|
86
|
-
|
|
87
|
-
* **fileKey**: le nom de l'élément form. Valeur par défaut est `file` . (DOMString)
|
|
88
|
-
* **fileName**: le nom de fichier à utiliser lorsque vous enregistrez le fichier sur le serveur. Valeur par défaut est `image.jpg` . (DOMString)
|
|
89
|
-
* **httpMethod**: méthode de The HTTP à utiliser - soit `PUT` ou `POST` . Valeur par défaut est `POST` . (DOMString)
|
|
90
|
-
* **type MIME**: le type mime des données à télécharger. Valeur par défaut est `image/jpeg` . (DOMString)
|
|
91
|
-
* **params**: un ensemble de paires clé/valeur facultative pour passer dans la requête HTTP. (Objet)
|
|
92
|
-
* **chunkedMode**: s'il faut télécharger les données en mode streaming mémorisé en bloc. Valeur par défaut est `true` . (Boolean)
|
|
93
|
-
* **headers**: une carte des valeurs d'en-tête en-tête/nom. Un tableau permet de spécifier plusieurs valeurs. Sur iOS, FireOS et Android, si un en-tête nommé Content-Type n'est présent, les données de formulaire multipart servira pas. (Object)
|
|
94
|
-
* **httpMethod**: The HTTP méthode à utiliser par exemple poster ou mis. Par défaut, `message`. (DOMString)
|
|
95
|
-
|
|
96
|
-
* **trustAllHosts**: paramètre facultatif, valeur par défaut est `false` . Si la valeur est `true` , il accepte tous les certificats de sécurité. Ceci est utile car Android rejette des certificats auto-signés. N'est pas recommandé pour une utilisation en production. Supporté sur Android et iOS. *(booléen)*
|
|
97
|
-
|
|
98
|
-
### Exemple
|
|
99
|
-
|
|
100
|
-
// !! Suppose fileURL variable contient une URL valide dans un fichier texte sur le périphérique, / / par exemple, cdvfile://localhost/persistent/path/to/file.txt var win = function (r) {console.log ("Code =" + r.responseCode) ;
|
|
101
|
-
Console.log ("réponse =" + r.response) ;
|
|
102
|
-
Console.log ("envoyés =" + r.bytesSent);}
|
|
103
|
-
|
|
104
|
-
échouer var = function (erreur) {alert ("une erreur est survenue : Code =" + error.code) ;
|
|
105
|
-
Console.log (« source de l'erreur de téléchargement » + error.source) ;
|
|
106
|
-
Console.log ("erreur de téléchargement cible" + error.target);}
|
|
107
|
-
|
|
108
|
-
options de var = new FileUploadOptions() ;
|
|
109
|
-
options.fileKey = « fichier » ;
|
|
110
|
-
options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1) ;
|
|
111
|
-
options.mimeType = « text/plain » ;
|
|
112
|
-
|
|
113
|
-
var params = {} ;
|
|
114
|
-
params.value1 = « test » ;
|
|
115
|
-
params.Value2 = « param » ;
|
|
116
|
-
|
|
117
|
-
options.params = params ;
|
|
118
|
-
|
|
119
|
-
ft var = new FileTransfer() ;
|
|
120
|
-
ft.upload (fileURL, encodeURI ("http://some.server.com/upload.php"), win, fail, options) ;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
### Exemple avec téléchargement du Header et des Progress Events (Android et iOS uniquement)
|
|
124
|
-
|
|
125
|
-
function win(r) {console.log ("Code =" + r.responseCode) ;
|
|
126
|
-
Console.log ("réponse =" + r.response) ;
|
|
127
|
-
Console.log ("envoyés =" + r.bytesSent);}
|
|
128
|
-
|
|
129
|
-
function fail(error) {alert ("une erreur est survenue : Code =" + error.code) ;
|
|
130
|
-
Console.log (« source de l'erreur de téléchargement » + error.source) ;
|
|
131
|
-
Console.log ("erreur de téléchargement cible" + error.target);}
|
|
132
|
-
|
|
133
|
-
var uri = encodeURI ("http://some.server.com/upload.php") ;
|
|
134
|
-
|
|
135
|
-
options de var = new FileUploadOptions() ;
|
|
136
|
-
options.fileKey="file" ;
|
|
137
|
-
options.fileName=fileURL.substr(fileURL.lastIndexOf('/')+1) ;
|
|
138
|
-
options.mimeType="text/plain" ;
|
|
139
|
-
|
|
140
|
-
en-têtes var ={'headerParam':'headerValue'} ;
|
|
141
|
-
|
|
142
|
-
options.Headers = en-têtes ;
|
|
143
|
-
|
|
144
|
-
ft var = new FileTransfer() ;
|
|
145
|
-
ft.OnProgress = function(progressEvent) {si (progressEvent.lengthComputable) {loadingStatus.setPercentage(progressEvent.loaded / progressEvent.total) ;
|
|
146
|
-
} else {loadingStatus.increment() ;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
ft.upload (fileURL, uri, win, fail, options) ;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
## FileUploadResult
|
|
153
|
-
|
|
154
|
-
A `FileUploadResult` objet est passé au rappel de succès la `FileTransfer` de l'objet `upload()` méthode.
|
|
155
|
-
|
|
156
|
-
### Propriétés
|
|
157
|
-
|
|
158
|
-
* **bytesSent** : le nombre d'octets envoyés au serveur dans le cadre du téléchargement. (long)
|
|
159
|
-
|
|
160
|
-
* **responseCode** : le code de réponse HTTP retourné par le serveur. (long)
|
|
161
|
-
|
|
162
|
-
* **response** : la réponse HTTP renvoyée par le serveur. (DOMString)
|
|
163
|
-
|
|
164
|
-
* **en-têtes** : en-têtes de réponse HTTP par le serveur. (Objet)
|
|
165
|
-
|
|
166
|
-
* Actuellement pris en charge sur iOS seulement.
|
|
167
|
-
|
|
168
|
-
### Notes au sujet d'iOS
|
|
169
|
-
|
|
170
|
-
* Ne prend pas en charge les propriétés `responseCode` et `bytesSent`.
|
|
171
|
-
|
|
172
|
-
## download
|
|
173
|
-
|
|
174
|
-
**Paramètres**:
|
|
175
|
-
|
|
176
|
-
* **source** : l'URL du serveur depuis lequel télécharger le fichier, encodée via `encodeURI()`.
|
|
177
|
-
|
|
178
|
-
* **target** : système de fichiers url représentant le fichier sur le périphérique. Pour la compatibilité ascendante, cela peut aussi être le chemin complet du fichier sur le périphérique. (Voir [Backwards Compatibility Notes] ci-dessous)
|
|
179
|
-
|
|
180
|
-
* **successCallback** : une callback de succès à laquelle est passée un objet `FileEntry`. *(Function)*
|
|
181
|
-
|
|
182
|
-
* **errorCallback**: un rappel qui s'exécute si une erreur se produit lors de la récupération du `FileEntry` . Appelée avec un `FileTransferError` objet. *(Fonction)*
|
|
183
|
-
|
|
184
|
-
* **trustAllHosts**: paramètre facultatif, valeur par défaut est `false` . Si la valeur est `true` , il accepte tous les certificats de sécurité. Ceci peut être utile car Android rejette les certificats auto-signés. N'est pas recommandé pour une utilisation en production. Supporté sur Android et iOS. *(booléen)*
|
|
185
|
-
|
|
186
|
-
* **options** : paramètres facultatifs, seules les en-têtes sont actuellement supportées (par exemple l'autorisation (authentification basique), etc.).
|
|
187
|
-
|
|
188
|
-
### Exemple
|
|
189
|
-
|
|
190
|
-
// !! Suppose fileURL variable contient une URL valide vers un chemin d'accès sur le périphérique, / / par exemple, transfert de fichiers var cdvfile://localhost/persistent/path/to/downloads/ = new FileTransfer() ;
|
|
191
|
-
var uri = encodeURI ("http://some.server.com/download.php") ;
|
|
192
|
-
|
|
193
|
-
fileTransfer.download (uri, fileURL, function(entry) {console.log ("téléchargement complet:" + entry.toURL()) ;
|
|
194
|
-
}, function(error) {console.log (« source de l'erreur de téléchargement » + error.source) ;
|
|
195
|
-
Console.log (« erreur de téléchargement cible » + error.target) ;
|
|
196
|
-
Console.log (« code d'erreur de téléchargement » + error.code) ;
|
|
197
|
-
}, faux, {en-têtes: {« Autorisation »: « dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA base == "}}) ;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
### Quirks wp8
|
|
201
|
-
|
|
202
|
-
* Télécharger demande est mis en cache par l'implémentation native. Pour éviter la mise en cache, pass `if-Modified-Since` en-tête Télécharger méthode.
|
|
203
|
-
|
|
204
|
-
## abort
|
|
205
|
-
|
|
206
|
-
Abandonne un transfert en cours. Le rappel onerror est passé à un objet FileTransferError qui a un code d'erreur de FileTransferError.ABORT_ERR.
|
|
207
|
-
|
|
208
|
-
### Exemple
|
|
209
|
-
|
|
210
|
-
// !! Suppose fileURL variable contient une URL valide dans un fichier texte sur le périphérique, / / par exemple, cdvfile://localhost/persistent/path/to/file.txt var win = function(r) {console.log ("ne devrait pas être appelée.");}
|
|
211
|
-
|
|
212
|
-
var fail = function(error) {/ / error.code == FileTransferError.ABORT_ERR alert ("une erreur est survenue : Code =" + error.code) ;
|
|
213
|
-
Console.log (« source de l'erreur de téléchargement » + error.source) ;
|
|
214
|
-
Console.log ("erreur de téléchargement cible" + error.target);}
|
|
215
|
-
|
|
216
|
-
options de var = new FileUploadOptions() ;
|
|
217
|
-
options.fileKey="file" ;
|
|
218
|
-
options.fileName="myphoto.jpg" ;
|
|
219
|
-
options.mimeType="image/jpeg" ;
|
|
220
|
-
|
|
221
|
-
ft var = new FileTransfer() ;
|
|
222
|
-
ft.upload (fileURL, encodeURI ("http://some.server.com/upload.php"), win, fail, options) ;
|
|
223
|
-
ft.Abort() ;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
## FileTransferError
|
|
227
|
-
|
|
228
|
-
A `FileTransferError` objet est passé à un rappel d'erreur lorsqu'une erreur survient.
|
|
229
|
-
|
|
230
|
-
### Propriétés
|
|
231
|
-
|
|
232
|
-
* **code** : l'un des codes d'erreur prédéfinis énumérés ci-dessous. (Number)
|
|
233
|
-
|
|
234
|
-
* **source** : l'URI de la source. (String)
|
|
235
|
-
|
|
236
|
-
* **target**: l'URI de la destination. (String)
|
|
237
|
-
|
|
238
|
-
* **http_status** : code d'état HTTP. Cet attribut n'est disponible que lorsqu'un code de réponse est fourni via la connexion HTTP. (Number)
|
|
239
|
-
|
|
240
|
-
* **corps** Corps de réponse. Cet attribut n'est disponible que lorsqu'une réponse est reçue de la connexion HTTP. (String)
|
|
241
|
-
|
|
242
|
-
* **exception**: soit e.getMessage ou e.toString (String)
|
|
243
|
-
|
|
244
|
-
### Constantes
|
|
245
|
-
|
|
246
|
-
* 1 = `FileTransferError.FILE_NOT_FOUND_ERR`
|
|
247
|
-
* 2 = `FileTransferError.INVALID_URL_ERR`
|
|
248
|
-
* 3 = `FileTransferError.CONNECTION_ERR`
|
|
249
|
-
* 4 = `FileTransferError.ABORT_ERR`
|
|
250
|
-
* 5 = `FileTransferError.NOT_MODIFIED_ERR`
|
|
251
|
-
|
|
252
|
-
## Backwards Compatibility Notes
|
|
253
|
-
|
|
254
|
-
Les versions précédentes de ce plugin n'accepterait périphérique--fichier-chemins d'accès absolus comme source pour les téléchargements, ou comme cible pour les téléchargements. Ces chemins seraient généralement de la forme
|
|
255
|
-
|
|
256
|
-
/ var/mobile/Applications/< application UUID >/Documents/chemin/vers/fichier (iOS), /storage/emulated/0/path/to/file (Android)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
Pour vers l'arrière la compatibilité, ces chemins sont toujours acceptés, et si votre application a enregistré des chemins comme celles-ci dans un stockage persistant, alors ils peuvent continuer à être utilisé.
|
|
260
|
-
|
|
261
|
-
Ces chemins ont été précédemment exposés dans le `fullPath` propriété de `FileEntry` et `DirectoryEntry` les objets retournés par le fichier plugin. Nouvelles versions du fichier plugin, cependant, ne plus exposent ces chemins à JavaScript.
|
|
262
|
-
|
|
263
|
-
Si vous migrez vers une nouvelle (1.0.0 ou plus récent) version de fichier et vous avez précédemment utilisé `entry.fullPath` comme arguments à `download()` ou `upload()` , alors vous aurez besoin de modifier votre code pour utiliser le système de fichiers URL au lieu de cela.
|
|
264
|
-
|
|
265
|
-
`FileEntry.toURL()`et `DirectoryEntry.toURL()` retournent une URL de système de fichiers du formulaire
|
|
266
|
-
|
|
267
|
-
cdvfile://localhost/persistent/path/to/file
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
qui peut être utilisé à la place le chemin d'accès absolu au fichier dans les deux `download()` et `upload()` méthodes.
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
# license: Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
|
4
|
-
# distributed with this work for additional information
|
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
|
7
|
-
# "License"); you may not use this file except in compliance
|
|
8
|
-
# with the License. You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
|
13
|
-
# software distributed under the License is distributed on an
|
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
# KIND, either express or implied. See the License for the
|
|
16
|
-
# specific language governing permissions and limitations
|
|
17
|
-
# under the License.
|
|
18
|
-
-->
|
|
19
|
-
|
|
20
|
-
# cordova-plugin-file-transfer
|
|
21
|
-
|
|
22
|
-
[](https://travis-ci.org/apache/cordova-plugin-file-transfer)
|
|
23
|
-
|
|
24
|
-
Documentazione plugin: <doc/index.md>
|
|
25
|
-
|
|
26
|
-
Questo plugin permette di caricare e scaricare file.
|
|
27
|
-
|
|
28
|
-
Questo plugin definisce globale `FileTransfer`, costruttori di `FileUploadOptions`.
|
|
29
|
-
|
|
30
|
-
Anche se in ambito globale, non sono disponibili fino a dopo l'evento `deviceready`.
|
|
31
|
-
|
|
32
|
-
document.addEventListener("deviceready", onDeviceReady, false);
|
|
33
|
-
function onDeviceReady() {
|
|
34
|
-
console.log(FileTransfer);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Installazione
|
|
39
|
-
|
|
40
|
-
cordova plugin add cordova-plugin-file-transfer
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Piattaforme supportate
|
|
44
|
-
|
|
45
|
-
* Amazon fuoco OS
|
|
46
|
-
* Android
|
|
47
|
-
* BlackBerry 10
|
|
48
|
-
* Browser
|
|
49
|
-
* Firefox OS**
|
|
50
|
-
* iOS
|
|
51
|
-
* Windows Phone 7 e 8 *
|
|
52
|
-
* Windows 8
|
|
53
|
-
* Windows
|
|
54
|
-
|
|
55
|
-
\ * *Non supportano `onprogress` né `abort()` *
|
|
56
|
-
|
|
57
|
-
\ * * *Non supportano `onprogress` *
|
|
58
|
-
|
|
59
|
-
# FileTransfer
|
|
60
|
-
|
|
61
|
-
L'oggetto `FileTransfer` fornisce un modo per caricare i file utilizzando una richiesta HTTP multiparte POST o PUT e scaricare file pure.
|
|
62
|
-
|
|
63
|
-
## Proprietà
|
|
64
|
-
|
|
65
|
-
* **OnProgress**: chiamata con un `ProgressEvent` ogni volta che un nuovo blocco di dati viene trasferito. *(Funzione)*
|
|
66
|
-
|
|
67
|
-
## Metodi
|
|
68
|
-
|
|
69
|
-
* **caricare**: invia un file a un server.
|
|
70
|
-
|
|
71
|
-
* **Scarica**: Scarica un file dal server.
|
|
72
|
-
|
|
73
|
-
* **Abort**: interrompe un trasferimento in corso.
|
|
74
|
-
|
|
75
|
-
## upload
|
|
76
|
-
|
|
77
|
-
**Parametri**:
|
|
78
|
-
|
|
79
|
-
* **fileURL**: Filesystem URL che rappresenta il file nel dispositivo. Per indietro la compatibilità, questo può anche essere il percorso completo del file sul dispositivo. (Vedere [indietro compatibilità rileva] qui sotto)
|
|
80
|
-
|
|
81
|
-
* **server**: URL del server per ricevere il file, come codificato dal`encodeURI()`.
|
|
82
|
-
|
|
83
|
-
* **successCallback**: un callback che viene passato un oggetto `FileUploadResult`. *(Funzione)*
|
|
84
|
-
|
|
85
|
-
* **errorCallback**: un callback che viene eseguito se si verifica un errore di recupero `FileUploadResult`. Richiamato con un oggetto `FileTransferError`. *(Funzione)*
|
|
86
|
-
|
|
87
|
-
* **opzioni**: parametri facoltativi *(oggetto)*. Chiavi valide:
|
|
88
|
-
|
|
89
|
-
* **fileKey**: il nome dell'elemento form. Valore predefinito è `file` . (DOMString)
|
|
90
|
-
* **nome file**: il nome del file da utilizzare quando si salva il file sul server. Valore predefinito è `image.jpg` . (DOMString)
|
|
91
|
-
* **httpMethod**: metodo HTTP da utilizzare - `PUT` o `POST`. Impostazioni predefinite per `POST`. (DOMString)
|
|
92
|
-
* **mimeType**: il tipo mime dei dati da caricare. Impostazioni predefinite su `image/jpeg`. (DOMString)
|
|
93
|
-
* **params**: un insieme di coppie chiave/valore opzionale per passare nella richiesta HTTP. (Object)
|
|
94
|
-
* **chunkedMode**: se a caricare i dati in modalità streaming chunked. Impostazione predefinita è `true`. (Boolean)
|
|
95
|
-
* **headers**: una mappa di valori di intestazione e nome dell'intestazione. Utilizzare una matrice per specificare più di un valore. Su iOS, FireOS e Android, se è presente, un'intestazione Content-Type il nome dati form multipart non verranno utilizzati. (Object)
|
|
96
|
-
* **httpMethod**: metodo HTTP da utilizzare per esempio POST o PUT. Il valore predefinito è `POST`. (DOMString)
|
|
97
|
-
|
|
98
|
-
* **trustAllHosts**: parametro opzionale, valore predefinito è `false` . Se impostata su `true` , accetta tutti i certificati di sicurezza. Questo è utile poiché Android respinge i certificati autofirmati sicurezza. Non raccomandato per uso in produzione. Supportato su Android e iOS. *(boolean)*
|
|
99
|
-
|
|
100
|
-
### Esempio
|
|
101
|
-
|
|
102
|
-
// !! Assumes variable fileURL contains a valid URL to a text file on the device,
|
|
103
|
-
// for example, cdvfile://localhost/persistent/path/to/file.txt
|
|
104
|
-
|
|
105
|
-
var win = function (r) {
|
|
106
|
-
console.log("Code = " + r.responseCode);
|
|
107
|
-
console.log("Response = " + r.response);
|
|
108
|
-
console.log("Sent = " + r.bytesSent);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var fail = function (error) {
|
|
112
|
-
alert("An error has occurred: Code = " + error.code);
|
|
113
|
-
console.log("upload error source " + error.source);
|
|
114
|
-
console.log("upload error target " + error.target);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
var options = new FileUploadOptions();
|
|
118
|
-
options.fileKey = "file";
|
|
119
|
-
options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
|
|
120
|
-
options.mimeType = "text/plain";
|
|
121
|
-
|
|
122
|
-
var params = {};
|
|
123
|
-
params.value1 = "test";
|
|
124
|
-
params.value2 = "param";
|
|
125
|
-
|
|
126
|
-
options.params = params;
|
|
127
|
-
|
|
128
|
-
var ft = new FileTransfer();
|
|
129
|
-
ft.upload(fileURL, encodeURI("http://some.server.com/upload.php"), win, fail, options);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
### Esempio con intestazioni di caricare ed eventi Progress (Android e iOS solo)
|
|
133
|
-
|
|
134
|
-
function win(r) {
|
|
135
|
-
console.log("Code = " + r.responseCode);
|
|
136
|
-
console.log("Response = " + r.response);
|
|
137
|
-
console.log("Sent = " + r.bytesSent);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function fail(error) {
|
|
141
|
-
alert("An error has occurred: Code = " + error.code);
|
|
142
|
-
console.log("upload error source " + error.source);
|
|
143
|
-
console.log("upload error target " + error.target);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
var uri = encodeURI("http://some.server.com/upload.php");
|
|
147
|
-
|
|
148
|
-
var options = new FileUploadOptions();
|
|
149
|
-
options.fileKey="file";
|
|
150
|
-
options.fileName=fileURL.substr(fileURL.lastIndexOf('/')+1);
|
|
151
|
-
options.mimeType="text/plain";
|
|
152
|
-
|
|
153
|
-
var headers={'headerParam':'headerValue'};
|
|
154
|
-
|
|
155
|
-
options.headers = headers;
|
|
156
|
-
|
|
157
|
-
var ft = new FileTransfer();
|
|
158
|
-
ft.onprogress = function(progressEvent) {
|
|
159
|
-
if (progressEvent.lengthComputable) {
|
|
160
|
-
loadingStatus.setPercentage(progressEvent.loaded / progressEvent.total);
|
|
161
|
-
} else {
|
|
162
|
-
loadingStatus.increment();
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
ft.upload(fileURL, uri, win, fail, options);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
## FileUploadResult
|
|
169
|
-
|
|
170
|
-
Un oggetto `FileUploadResult` viene passato al metodo di callback del metodo `upload()` dell'oggetto `FileTransfer` successo.
|
|
171
|
-
|
|
172
|
-
### Proprietà
|
|
173
|
-
|
|
174
|
-
* **bytesSent**: il numero di byte inviati al server come parte dell'upload. (lungo)
|
|
175
|
-
|
|
176
|
-
* **responseCode**: codice di risposta HTTP restituito dal server. (lungo)
|
|
177
|
-
|
|
178
|
-
* **risposta**: risposta HTTP restituito dal server. (DOMString)
|
|
179
|
-
|
|
180
|
-
* **intestazioni**: intestazioni di risposta HTTP dal server. (Oggetto)
|
|
181
|
-
|
|
182
|
-
* Attualmente supportato solo iOS.
|
|
183
|
-
|
|
184
|
-
### iOS stranezze
|
|
185
|
-
|
|
186
|
-
* Non supporta `responseCode` o`bytesSent`.
|
|
187
|
-
|
|
188
|
-
## Scarica
|
|
189
|
-
|
|
190
|
-
**Parametri**:
|
|
191
|
-
|
|
192
|
-
* **fonte**: URL del server per scaricare il file, come codificato dal`encodeURI()`.
|
|
193
|
-
|
|
194
|
-
* **destinazione**: Filesystem url che rappresenta il file nel dispositivo. Per indietro la compatibilità, questo può anche essere il percorso completo del file sul dispositivo. (Vedere [indietro compatibilità rileva] qui sotto)
|
|
195
|
-
|
|
196
|
-
* **successCallback**: un callback passato un `FileEntry` oggetto. *(Funzione)*
|
|
197
|
-
|
|
198
|
-
* **errorCallback**: un callback che viene eseguito se si verifica un errore durante il recupero `FileEntry`. Richiamato con un oggetto `FileTransferError`. *(Function)*
|
|
199
|
-
|
|
200
|
-
* **trustAllHosts**: parametro opzionale, valore predefinito è `false` . Se impostata su `true` , accetta tutti i certificati di sicurezza. Questo è utile perché Android respinge i certificati autofirmati sicurezza. Non raccomandato per uso in produzione. Supportato su Android e iOS. *(boolean)*
|
|
201
|
-
|
|
202
|
-
* **opzioni**: parametri facoltativi, attualmente solo supporti intestazioni (ad esempio autorizzazione (autenticazione di base), ecc.).
|
|
203
|
-
|
|
204
|
-
### Esempio
|
|
205
|
-
|
|
206
|
-
// !! Assumes variable fileURL contains a valid URL to a path on the device,
|
|
207
|
-
// for example, cdvfile://localhost/persistent/path/to/downloads/
|
|
208
|
-
|
|
209
|
-
var fileTransfer = new FileTransfer();
|
|
210
|
-
var uri = encodeURI("http://some.server.com/download.php");
|
|
211
|
-
|
|
212
|
-
fileTransfer.download(
|
|
213
|
-
uri,
|
|
214
|
-
fileURL,
|
|
215
|
-
function(entry) {
|
|
216
|
-
console.log("download complete: " + entry.toURL());
|
|
217
|
-
},
|
|
218
|
-
function(error) {
|
|
219
|
-
console.log("download error source " + error.source);
|
|
220
|
-
console.log("download error target " + error.target);
|
|
221
|
-
console.log("upload error code" + error.code);
|
|
222
|
-
},
|
|
223
|
-
false,
|
|
224
|
-
{
|
|
225
|
-
headers: {
|
|
226
|
-
"Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
### WP8 stranezze
|
|
233
|
-
|
|
234
|
-
* Il download richiede è nella cache di implementazione nativa. Per evitare la memorizzazione nella cache, passare `if-Modified-Since` intestazione per metodo di download.
|
|
235
|
-
|
|
236
|
-
## Abort
|
|
237
|
-
|
|
238
|
-
Interrompe un trasferimento in corso. Il callback onerror viene passato un oggetto FileTransferError che presenta un codice di errore di FileTransferError.ABORT_ERR.
|
|
239
|
-
|
|
240
|
-
### Esempio
|
|
241
|
-
|
|
242
|
-
// !! Assumes variable fileURL contains a valid URL to a text file on the device,
|
|
243
|
-
// for example, cdvfile://localhost/persistent/path/to/file.txt
|
|
244
|
-
|
|
245
|
-
var win = function(r) {
|
|
246
|
-
console.log("Should not be called.");
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
var fail = function(error) {
|
|
250
|
-
// error.code == FileTransferError.ABORT_ERR
|
|
251
|
-
alert("An error has occurred: Code = " + error.code);
|
|
252
|
-
console.log("upload error source " + error.source);
|
|
253
|
-
console.log("upload error target " + error.target);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
var options = new FileUploadOptions();
|
|
257
|
-
options.fileKey="file";
|
|
258
|
-
options.fileName="myphoto.jpg";
|
|
259
|
-
options.mimeType="image/jpeg";
|
|
260
|
-
|
|
261
|
-
var ft = new FileTransfer();
|
|
262
|
-
ft.upload(fileURL, encodeURI("http://some.server.com/upload.php"), win, fail, options);
|
|
263
|
-
ft.abort();
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
## FileTransferError
|
|
267
|
-
|
|
268
|
-
Un oggetto `FileTransferError` viene passato a un callback di errore quando si verifica un errore.
|
|
269
|
-
|
|
270
|
-
### Proprietà
|
|
271
|
-
|
|
272
|
-
* **codice**: uno dei codici di errore predefiniti elencati di seguito. (Numero)
|
|
273
|
-
|
|
274
|
-
* **fonte**: URL all'origine. (String)
|
|
275
|
-
|
|
276
|
-
* **destinazione**: URL di destinazione. (String)
|
|
277
|
-
|
|
278
|
-
* **http_status**: codice di stato HTTP. Questo attributo è disponibile solo quando viene ricevuto un codice di risposta della connessione HTTP. (Numero)
|
|
279
|
-
|
|
280
|
-
* **body** Corpo della risposta. Questo attributo è disponibile solo quando viene ricevuta una risposta dalla connessione HTTP. (String)
|
|
281
|
-
|
|
282
|
-
* **exception**: O e.getMessage o e.toString (String)
|
|
283
|
-
|
|
284
|
-
### Costanti
|
|
285
|
-
|
|
286
|
-
* 1 = `FileTransferError.FILE_NOT_FOUND_ERR`
|
|
287
|
-
* 2 = `FileTransferError.INVALID_URL_ERR`
|
|
288
|
-
* 3 = `FileTransferError.CONNECTION_ERR`
|
|
289
|
-
* 4 = `FileTransferError.ABORT_ERR`
|
|
290
|
-
* 5 = `FileTransferError.NOT_MODIFIED_ERR`
|
|
291
|
-
|
|
292
|
-
## Note di compatibilità all'indietro
|
|
293
|
-
|
|
294
|
-
Versioni precedenti di questo plugin accetterebbe solo dispositivo-assoluto-percorsi di file come origine per upload, o come destinazione per il download. Questi percorsi si sarebbero generalmente di forma
|
|
295
|
-
|
|
296
|
-
/var/mobile/Applications/<application UUID>/Documents/path/to/file (iOS)
|
|
297
|
-
/storage/emulated/0/path/to/file (Android)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
Per indietro compatibilità, questi percorsi sono ancora accettati, e se l'applicazione ha registrato percorsi come questi in un archivio permanente, quindi possono continuare a essere utilizzato.
|
|
301
|
-
|
|
302
|
-
Questi percorsi sono stati precedentemente esposti nella proprietà `fullPath` di `FileEntry` e oggetti `DirectoryEntry` restituiti dal File plugin. Nuove versioni del File plugin, tuttavia, non è più espongono questi percorsi a JavaScript.
|
|
303
|
-
|
|
304
|
-
Se si esegue l'aggiornamento a una nuova (1.0.0 o più recente) versione del File e si hanno precedentemente utilizzato `entry.fullPath` come argomenti per `download()` o `upload()`, quindi sarà necessario cambiare il codice per utilizzare gli URL filesystem invece.
|
|
305
|
-
|
|
306
|
-
`FileEntry.toURL()` e `DirectoryEntry.toURL()` restituiscono un filesystem URL del modulo
|
|
307
|
-
|
|
308
|
-
cdvfile://localhost/persistent/path/to/file
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
che può essere utilizzato al posto del percorso assoluto nei metodi sia `download()` e `upload()`.
|