@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.
Files changed (34) hide show
  1. package/doc/changelog.md +3 -0
  2. package/esm2020/src/app/core/form/form.utils.mjs +1 -2
  3. package/esm2020/src/app/core/table/table.class.mjs +3 -3
  4. package/esm2020/src/app/shared/dates.mjs +2 -2
  5. package/fesm2015/sumaris-net.ngx-components.mjs +3 -4
  6. package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
  7. package/fesm2020/sumaris-net.ngx-components.mjs +3 -4
  8. package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/README.md +5 -6
  11. package/src/app/core/form/form.utils.d.ts +0 -1
  12. package/src/app/core/table/table.class.d.ts +3 -1
  13. package/plugins/clovelced-plugin-audiomanagement/README.md +0 -66
  14. package/plugins/cordova-plugin-camera/README.md +0 -703
  15. package/plugins/cordova-plugin-device/README.md +0 -309
  16. package/plugins/cordova-plugin-file/README.md +0 -848
  17. package/plugins/cordova-plugin-file-transfer/README.md +0 -598
  18. package/plugins/cordova-plugin-file-transfer/doc/de/README.md +0 -311
  19. package/plugins/cordova-plugin-file-transfer/doc/es/README.md +0 -311
  20. package/plugins/cordova-plugin-file-transfer/doc/fr/README.md +0 -270
  21. package/plugins/cordova-plugin-file-transfer/doc/it/README.md +0 -311
  22. package/plugins/cordova-plugin-file-transfer/doc/ja/README.md +0 -311
  23. package/plugins/cordova-plugin-file-transfer/doc/ko/README.md +0 -311
  24. package/plugins/cordova-plugin-file-transfer/doc/pl/README.md +0 -311
  25. package/plugins/cordova-plugin-file-transfer/doc/zh/README.md +0 -311
  26. package/plugins/cordova-plugin-ionic-keyboard/README.md +0 -220
  27. package/plugins/cordova-plugin-ionic-webview/README.md +0 -181
  28. package/plugins/cordova-plugin-media-capture/README.md +0 -626
  29. package/plugins/cordova-plugin-splashscreen/README.md +0 -387
  30. package/plugins/cordova-plugin-statusbar/README.md +0 -341
  31. package/plugins/cordova-plugin-telerik-imagepicker/README.md +0 -155
  32. package/plugins/cordova-plugin-whitelist/README.md +0 -185
  33. package/plugins/cordova-sqlite-storage/README.md +0 -1848
  34. package/plugins/integrator-cordova-plugin-downloader/README.md +0 -49
@@ -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
- [![Build Status](https://travis-ci.org/apache/cordova-plugin-file-transfer.svg)](https://travis-ci.org/apache/cordova-plugin-file-transfer)
23
-
24
- Plugin dokumentacja: <doc/index.md>
25
-
26
- Plugin pozwala na przesyłanie i pobieranie plików.
27
-
28
- Ten plugin określa globalne `FileTransfer`, `FileUploadOptions` konstruktorów.
29
-
30
- Chociaż w globalnym zasięgu, są nie dostępne dopiero po `deviceready` imprezie.
31
-
32
- document.addEventListener("deviceready", onDeviceReady, false);
33
- function onDeviceReady() {
34
- console.log(FileTransfer);
35
- }
36
-
37
-
38
- ## Instalacja
39
-
40
- cordova plugin add cordova-plugin-file-transfer
41
-
42
-
43
- ## Obsługiwane platformy
44
-
45
- * Amazon Fire OS
46
- * Android
47
- * BlackBerry 10
48
- * Przeglądarka
49
- * Firefox OS **
50
- * iOS
51
- * Windows Phone 7 i 8 *
52
- * Windows 8
53
- * Windows
54
-
55
- \ * *Nie obsługują `onprogress` ani `abort()` *
56
-
57
- \ ** *Nie obsługują `onprogress` *
58
-
59
- # FileTransfer
60
-
61
- Obiekt `FileTransfer` zapewnia sposób wgrać pliki za pomocą Multi-część POST lub PUT żądania HTTP i pobierania plików, jak również.
62
-
63
- ## Właściwości
64
-
65
- * **OnProgress**: o nazwie `ProgressEvent` gdy nowy kawałek danych jest przenoszona. *(Funkcja)*
66
-
67
- ## Metody
68
-
69
- * **wgraj**: wysyła plik na serwer.
70
-
71
- * **do pobrania**: pliki do pobrania pliku z serwera.
72
-
73
- * **przerwać**: przerywa w toku transferu.
74
-
75
- ## upload
76
-
77
- **Parametry**:
78
-
79
- * **fileURL**: URL plików reprezentujących pliku na urządzenie. Dla wstecznej kompatybilności, to może również być pełną ścieżkę pliku na urządzenie. (Zobacz [wstecz zgodności zauważa] poniżej)
80
-
81
- * **serwer**: adres URL serwera, aby otrzymać plik, jak kodowane przez`encodeURI()`.
82
-
83
- * **successCallback**: wywołania zwrotnego, który jest przekazywany obiekt `FileUploadResult`. *(Funkcja)*
84
-
85
- * **errorCallback**: wywołanie zwrotne, które wykonuje, jeżeli wystąpi błąd pobierania `FileUploadResult`. Wywoływany z obiektu `FileTransferError`. *(Funkcja)*
86
-
87
- * **Opcje**: parametry opcjonalne *(obiektu)*. Ważne klucze:
88
-
89
- * **fileKey**: nazwa elementu form. Domyślnie `file` . (DOMString)
90
- * **Nazwa pliku**: nazwy pliku, aby użyć podczas zapisywania pliku na serwerze. Domyślnie `image.jpg` . (DOMString)
91
- * **element httpMethod**: Metoda HTTP do użycia - `umieścić` lub `POST`. Domyślnie `POST`. (DOMString)
92
- * **mimeType**: Typ mime danych do przesłania. Domyślnie do `image/jpeg`. (DOMString)
93
- * **params**: zestaw par opcjonalny klucz/wartość w żądaniu HTTP. (Obiekt)
94
- * **chunkedMode**: czy przekazać dane w trybie pakietowego przesyłania strumieniowego. Wartością domyślną jest `true`. (Wartość logiczna)
95
- * **headers**: Mapa wartości Nazwa/nagłówka nagłówek. Aby określić więcej niż jedną wartość, należy użyć tablicę. Na iOS, FireOS i Android jeśli nagłówek o nazwie Content-Type jest obecny, wieloczęściowa forma nie danych. (Object)
96
- * **element httpMethod**: Metoda HTTP np. POST lub PUT. Ustawienia domyślne do `POST`. (DOMString)
97
-
98
- * **trustAllHosts**: parametr opcjonalny, domyślnie `false` . Jeśli zestaw `true` , to akceptuje wszystkie certyfikaty bezpieczeństwa. Jest to przydatne, ponieważ Android odrzuca Certyfikaty samopodpisane. Nie zaleca się do użytku produkcyjnego. Obsługiwane na Androida i iOS. *(wartość logiczna)*
99
-
100
- ### Przykład
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
- ### Przykład z Prześlij nagłówki i zdarzeń postępu (Android i iOS tylko)
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
- Obiekt `FileUploadResult` jest przekazywana do sukcesu wywołania zwrotnego metody `upload() służącą` obiektu `FileTransfer`.
171
-
172
- ### Właściwości
173
-
174
- * **bytesSent**: liczba bajtów wysłanych do serwera jako część upload. (długie)
175
-
176
- * **responseCode**: kod odpowiedzi HTTP, zwracane przez serwer. (długie)
177
-
178
- * **odpowiedź**: HTTP odpowiedzi zwracane przez serwer. (DOMString)
179
-
180
- * **nagłówki**: nagłówki HTTP odpowiedzi przez serwer. (Obiekt)
181
-
182
- * Obecnie obsługiwane na iOS tylko.
183
-
184
- ### Dziwactwa iOS
185
-
186
- * Nie obsługuje `responseCode` lub`bytesSent`.
187
-
188
- ## download
189
-
190
- **Parametry**:
191
-
192
- * **Źródło**: adres URL serwera, aby pobrać plik, jak kodowane przez`encodeURI()`.
193
-
194
- * **cel**: url plików reprezentujących pliku na urządzenie. Dla wstecznej kompatybilności, to może również być pełną ścieżkę pliku na urządzenie. (Zobacz [wstecz zgodności zauważa] poniżej)
195
-
196
- * **successCallback**: wywołania zwrotnego, który jest przekazywany `FileEntry` obiektu. *(Funkcja)*
197
-
198
- * **errorCallback**: wywołanie zwrotne, które wykonuje, jeśli wystąpi błąd podczas pobierania `FileEntry`. Wywoływany z obiektu `FileTransferError`. *(Funkcja)*
199
-
200
- * **trustAllHosts**: parametr opcjonalny, domyślnie `false` . Jeśli zestaw `true` , to akceptuje wszystkie certyfikaty bezpieczeństwa. Jest to przydatne, ponieważ Android odrzuca Certyfikaty samopodpisane. Nie zaleca się do użytku produkcyjnego. Obsługiwane na Androida i iOS. *(wartość logiczna)*
201
-
202
- * **Opcje**: parametry opcjonalne, obecnie tylko obsługuje nagłówki (takie jak autoryzacja (uwierzytelnianie podstawowe), itp.).
203
-
204
- ### Przykład
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 dziwactwa
233
-
234
- * Pobierz wnioski są buforowane przez rodzimych realizacji. Aby uniknąć, buforowanie, przekazać `if-Modified-Since` nagłówka do pobrania Metoda.
235
-
236
- ## abort
237
-
238
- Przerywa w toku transferu. Onerror callback jest przekazywany obiekt FileTransferError, który kod błędu z FileTransferError.ABORT_ERR.
239
-
240
- ### Przykład
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
- Obiekt `FileTransferError` jest przekazywana do błąd wywołania zwrotnego, gdy wystąpi błąd.
269
-
270
- ### Właściwości
271
-
272
- * **Kod**: jeden z kodów błędów wstępnie zdefiniowanych poniżej. (Liczba)
273
-
274
- * **Źródło**: URL do źródła. (String)
275
-
276
- * **cel**: adres URL do docelowego. (String)
277
-
278
- * **HTTP_STATUS**: kod stanu HTTP. Ten atrybut jest dostępna tylko po otrzymaniu kodu odpowiedzi z połączenia HTTP. (Liczba)
279
-
280
- * **body** Treść odpowiedzi. Ten atrybut jest dostępna tylko wtedy, gdy odpowiedź jest otrzymanych od połączenia HTTP. (String)
281
-
282
- * **exception**: albo e.getMessage lub e.toString (String)
283
-
284
- ### Stałe
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
- ## Do tyłu zgodności stwierdza
293
-
294
- Poprzednie wersje tego pluginu tylko zaakceptować urządzenia bezwzględnych ścieżek jako źródło dla przekazywania, lub w celu pobrania. Te ścieżki będzie zazwyczaj formy
295
-
296
- /var/mobile/Applications/<application UUID>/Documents/path/to/file (iOS)
297
- /storage/emulated/0/path/to/file (Android)
298
-
299
-
300
- Do tyłu zgodności, akceptowane są jeszcze te ścieżki, i jeśli aplikacja nagrał ścieżki, jak te w trwałej pamięci, następnie można nadal stosować.
301
-
302
- Te ścieżki były narażone wcześniej we właściwości `fullPath` `FileEntry` i `DirectoryEntry` obiektów zwróconych przez wtyczki pliku. Nowe wersje pliku plugin, jednak już wystawiać te ścieżki do JavaScript.
303
-
304
- Jeśli uaktualniasz nowy (1.0.0 lub nowsza) wersja pliku i mieć wcześniej przy `entry.fullPath` jako argumenty `download()` lub `upload() służącą`, a następnie trzeba będzie zmienić kod aby używać adresów URL plików zamiast.
305
-
306
- `FileEntry.toURL()` i `DirectoryEntry.toURL()` zwraca adres URL plików formularza
307
-
308
- cdvfile://localhost/persistent/path/to/file
309
-
310
-
311
- które mogą być używane zamiast bezwzględna ścieżka zarówno `download()` i `metody upload()` metody.
@@ -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
- [![Build Status](https://travis-ci.org/apache/cordova-plugin-file-transfer.svg)](https://travis-ci.org/apache/cordova-plugin-file-transfer)
23
-
24
- 外掛程式檔: <doc/index.md>
25
-
26
- 這個外掛程式允許你上傳和下載檔案。
27
-
28
- 這個外掛程式定義全域 `FileTransfer`,`FileUploadOptions` 的建構函式。
29
-
30
- 雖然在全球範圍內,他們不可用直到 `deviceready` 事件之後。
31
-
32
- document.addEventListener("deviceready", onDeviceReady, false);
33
- function onDeviceReady() {
34
- console.log(FileTransfer);
35
- }
36
-
37
-
38
- ## 安裝
39
-
40
- cordova plugin add cordova-plugin-file-transfer
41
-
42
-
43
- ## 支援的平臺
44
-
45
- * 亞馬遜火 OS
46
- * Android 系統
47
- * 黑莓 10
48
- * 瀏覽器
49
- * 火狐瀏覽器的作業系統 * *
50
- * iOS
51
- * Windows Phone 7 和 8 *
52
- * Windows 8
53
- * Windows
54
-
55
- \ **不支援`onprogress`也`abort()` *
56
-
57
- \ * **不支援`onprogress` *
58
-
59
- # 檔案傳輸
60
-
61
- `FileTransfer`物件提供上傳檔使用 HTTP 多部分職位或付諸表決的請求,並將檔以及下載的方式。
62
-
63
- ## 屬性
64
-
65
- * **onprogress**: 使用調用 `ProgressEvent` 每當一塊新的資料傳輸。*(函數)*
66
-
67
- ## 方法
68
-
69
- * **upload**: 將檔發送到伺服器。
70
-
71
- * **download**: 從伺服器上下載檔案。
72
-
73
- * **abort**: 中止正在進行轉讓。
74
-
75
- ## upload
76
-
77
- **參數**:
78
-
79
- * **fileURL**: 表示檔在設備上的檔案系統 URL。 為向後相容性,這也可以將設備上的檔的完整路徑。 (請參見 [向後相容性注意到] 下面)
80
-
81
- * **server**: 伺服器以接收該檔,由編碼的 URL`encodeURI()`.
82
-
83
- * **successCallback**: 一個通過一個 `FileUploadResult` 物件的回檔。*(函數)*
84
-
85
- * **errorCallback**: 如果發生錯誤,檢索 `FileUploadResult` 執行一個回檔。使用 `FileTransferError` 物件調用。*(函數)*
86
-
87
- * **options**: 可選參數*(物件)*。有效的金鑰:
88
-
89
- * **fileKey**: 表單元素的名稱。預設值為 `file` 。() DOMString
90
- * **fileName**: 要保存在伺服器上的檔時使用的檔案名稱。預設值為 `image.jpg` 。() DOMString
91
- * **httpMethod**: HTTP 方法使用-`PUT` 或 `POST`。預設值為 `POST`。() DOMString
92
- * **mimeType**: 要上載的資料的 mime 類型。預設設置為 `image/jpeg`。() DOMString
93
- * **params**: 一組要在 HTTP 要求中傳遞的可選的鍵值對。(物件)
94
- * **chunkedMode**: 是否要分塊的流式處理模式中的資料上載。預設值為 `true`。(布林值)
95
- * **headers**: 地圖的標頭名稱/標頭值。 使用陣列來指定多個值。 IOS、 FireOS,和安卓系統,如果已命名的內容類型標頭存在,多部分表單資料不被使用。 (Object)
96
- * **httpMethod**: HTTP 方法,例如使用張貼或放。 預設為`開機自檢`。() DOMString
97
-
98
- * **trustAllHosts**: 可選參數,預設值為 `false` 。 如果設置為 `true` ,它可以接受的所有安全證書。 這是有用的因為 android 系統拒絕自簽名的安全證書。 不建議供生產使用。 在 Android 和 iOS 上受支援。 *(布林值)*
99
-
100
- ### 示例
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
- ### 與上傳的標頭和進度事件 (Android 和 iOS 只) 的示例
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
- `FileUploadResult` 物件將傳遞給該 `檔案傳輸` 物件的 `upload()` 方法的成功回檔。
171
-
172
- ### 屬性
173
-
174
- * **bytesSent**: 作為上載的一部分發送到伺服器的位元組數。(長)
175
-
176
- * **responseCode**: 由伺服器返回的 HTTP 回應代碼。(長)
177
-
178
- * **response**: 由伺服器返回的 HTTP 回應。() DOMString
179
-
180
- * **headers**: 由伺服器的 HTTP 回應標頭。(物件)
181
-
182
- * 目前支援的 iOS 只。
183
-
184
- ### iOS 的怪癖
185
-
186
- * 不支援 `responseCode` 或`bytesSent`.
187
-
188
- ## download
189
-
190
- **參數**:
191
-
192
- * **source**: 要下載的檔,如由編碼的伺服器的 URL`encodeURI()`.
193
-
194
- * **target**: 表示檔在設備上的檔案系統 url。 為向後相容性,這也可以將設備上的檔的完整路徑。 (請參見 [向後相容性注意到] 下面)
195
-
196
- * **successCallback**: 傳遞一個回檔 `FileEntry` 物件。*(函數)*
197
-
198
- * **errorCallback**: 如果檢索 `FileEntry` 時發生錯誤,則執行一個回檔。使用 `FileTransferError` 物件調用。*(函數)*
199
-
200
- * **trustAllHosts**: 可選參數,預設值為 `false` 。 如果設置為 `true` ,它可以接受的所有安全證書。 這是有用的因為 Android 拒絕自行簽署式安全證書。 不建議供生產使用。 在 Android 和 iOS 上受支援。 *(布林值)*
201
-
202
- * **options**: 可選參數,目前只支援標題 (如授權 (基本驗證) 等)。
203
-
204
- ### 示例
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 的怪癖
233
-
234
- * 下載請求由本機實現被緩存。若要避免緩存,傳遞`如果修改自`郵件頭以下載方法。
235
-
236
- ## abort
237
-
238
- 中止正在進行轉讓。Onerror 回檔傳遞一個 FileTransferError 物件具有 FileTransferError.ABORT_ERR 錯誤代碼。
239
-
240
- ### 示例
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
- 當發生錯誤時,`FileTransferError` 物件將傳遞給錯誤回檔。
269
-
270
- ### 屬性
271
-
272
- * **code**: 下面列出的預定義的錯誤代碼之一。(人數)
273
-
274
- * **source**: 源的 URL。(字串)
275
-
276
- * **target**: 到目標 URL。(字串)
277
-
278
- * **HTTP_status**: HTTP 狀態碼。從 HTTP 連接收到一個回應代碼時,此屬性才可用。(人數)
279
-
280
- * **body**回應正文。此屬性只能是可用的當該 HTTP 連接收到答覆。(字串)
281
-
282
- * **exception**: 要麼 e.getMessage 或 e.toString (字串)
283
-
284
- ### 常量
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
- ## 向後相容性注意到
293
-
294
- 以前版本的這個外掛程式才會接受設備-絕對檔路徑作為源對於上載,或用於下載的目標。這些路徑通常會在表單
295
-
296
- /var/mobile/Applications/<application UUID>/Documents/path/to/file (iOS)
297
- /storage/emulated/0/path/to/file (Android)
298
-
299
-
300
- 為向後相容性,這些路徑仍會被接受,和如果您的應用程式已錄得像這些在持久性存儲的路徑,然後他們可以繼續使用。
301
-
302
- 這些路徑被以前暴露在 `FileEntry` 和由檔外掛程式返回的 `DirectoryEntry` 物件的 `fullPath` 屬性中。 新版本的檔的外掛程式,但是,不再公開這些 JavaScript 的路徑。
303
-
304
- 如果您要升級到新 (1.0.0 或更高版本) 版本的檔,和你以前一直在使用 `entry.fullPath` 作為參數到 `download()` 或 `upload()`,那麼你將需要更改代碼以使用檔案系統的 Url 來代替。
305
-
306
- `FileEntry.toURL()` 和 `DirectoryEntry.toURL()` 返回的表單檔案 URL
307
-
308
- cdvfile://localhost/persistent/path/to/file
309
-
310
-
311
- 它可以用在 `download()` 和 `upload()` 兩種方法中的絕對檔路徑位置。