cordova-plugin-file
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -99,4 +99,4 @@ <!--- | ||
| `Cloud/` | syncedDataDirectory | - | R/w | Ja | Nein | Ja | Ja | | ||
| `Caches/` | cacheDirectory | Cache | R/w | Ja * | Ja \* * *| | Nein | Ja | | ||
| `tmp/` | tempDirectory | - | R/w | Nicht * * | Ja \* * *| | Nein | Ja | | ||
| `Caches/` | cacheDirectory | Cache | R/w | Ja * | Ja * * *| | Nein | Ja | | ||
| `tmp/` | tempDirectory | - | R/w | Nicht * * | Ja * * *| | Nein | Ja | | ||
@@ -107,3 +107,3 @@ * Dateien werden hinweg app Neustarts und Upgrades beibehalten, aber dieses Verzeichnis kann gelöscht werden, wenn das OS begehrt. Ihre Anwendung sollte in der Lage, Inhalte zu erschaffen, die möglicherweise gelöscht werden. | ||
\* * *| The OS kann den Inhalt dieses Verzeichnisses löschen, wenn es sich anfühlt, ist es erforderlich, aber verlassen Sie sich nicht dazu. Sie sollten dieses Verzeichnis entsprechend Ihrer Anwendung deaktivieren. | ||
* * *| The OS kann den Inhalt dieses Verzeichnisses löschen, wenn es sich anfühlt, ist es erforderlich, aber verlassen Sie sich nicht dazu. Sie sollten dieses Verzeichnis entsprechend Ihrer Anwendung deaktivieren. | ||
@@ -143,3 +143,3 @@ ### Android File System-Layout | ||
## Android Macken | ||
## Android Eigenarten | ||
@@ -146,0 +146,0 @@ ### Android permanenten Speicherort |
@@ -45,3 +45,3 @@ <!--- | ||
* Amazon fuego OS | ||
* Amazon fire OS | ||
* Android | ||
@@ -100,4 +100,4 @@ * BlackBerry 10 | ||
| `Cloud/` | syncedDataDirectory | - | r/w | Sí | No | Sí | Sí | | ||
| `Caches/` | cacheDirectory | caché | r/w | Sí * | Si \* * *| | No | Sí | | ||
| `tmp/` | tempDirectory | - | r/w | No * * | Si \* * *| | No | Sí | | ||
| `Caches/` | cacheDirectory | caché | r/w | Sí * | Si * * *| | No | Sí | | ||
| `tmp/` | tempDirectory | - | r/w | No * * | Si * * *| | No | Sí | | ||
@@ -108,3 +108,3 @@ * Archivos persisten a través de la aplicación se reinicia y actualizaciones, pero este directorio puede ser despejó cuando el OS desea. Su aplicación debe ser capaz de recrear cualquier contenido que puede ser eliminado. | ||
\* * *| OS la puede borrar el contenido de este directorio cuando se siente que es necesario, pero no dependen de éste. Debe borrar este directorio según sea apropiado para su aplicación. | ||
* * *| OS la puede borrar el contenido de este directorio cuando se siente que es necesario, pero no dependen de éste. Debe borrar este directorio según sea apropiado para su aplicación. | ||
@@ -111,0 +111,0 @@ ### Disposición del sistema Android File |
@@ -99,4 +99,4 @@ <!--- | ||
| `Cloud/` | syncedDataDirectory | - | r/w | Oui | Non | Oui | Oui | | ||
| `Caches/` | cacheDirectory | cache | r/w | Oui * | Oui \* * *| | Non | Oui | | ||
| `tmp/` | tempDirectory | - | r/w | Ne * * | Oui \* * *| | Non | Oui | | ||
| `Caches/` | cacheDirectory | cache | r/w | Oui * | Oui * * *| | Non | Oui | | ||
| `tmp/` | tempDirectory | - | r/w | Ne * * | Oui * * *| | Non | Oui | | ||
@@ -107,3 +107,3 @@ * Fichiers persistent à travers les redémarrages de l'application et mises à niveau, mais ce répertoire peut être effacé à chaque fois que les désirs de l'OS. Votre application doit être en mesure de recréer tout contenu qui pourrait être supprimé. | ||
\* * *| L'OS peut effacer le contenu de ce répertoire chaque fois qu'il se sent il est nécessaire, mais ne comptez pas là-dessus. Vous devez supprimer ce répertoire comme approprié pour votre application. | ||
* * *| L'OS peut effacer le contenu de ce répertoire chaque fois qu'il se sent il est nécessaire, mais ne comptez pas là-dessus. Vous devez supprimer ce répertoire comme approprié pour votre application. | ||
@@ -110,0 +110,0 @@ ### Agencement de système de fichiers Android |
@@ -43,2 +43,11 @@ <!--- | ||
This plugin defines global `cordova.file` object. | ||
Although in the global scope, it is not available until after the `deviceready` event. | ||
document.addEventListener("deviceready", onDeviceReady, false); | ||
function onDeviceReady() { | ||
console.log(cordova.file); | ||
} | ||
## Installation | ||
@@ -45,0 +54,0 @@ |
@@ -99,4 +99,4 @@ <!--- | ||
| `Cloud/` | syncedDataDirectory | - | r/w | Sì | No | Sì | Sì | | ||
| `Caches/` | cacheDirectory | cache | r/w | Sì * | Sì \* * *| | No | Sì | | ||
| `tmp/` | tempDirectory | - | r/w | No * * | Sì \* * *| | No | Sì | | ||
| `Caches/` | cacheDirectory | cache | r/w | Sì * | Sì * * *| | No | Sì | | ||
| `tmp/` | tempDirectory | - | r/w | No * * | Sì * * *| | No | Sì | | ||
@@ -107,3 +107,3 @@ * File persistono attraverso riavvii app e aggiornamenti, ma questa directory può essere azzerata ogni volta che desideri l'OS. L'app dovrebbe essere in grado di ricreare qualsiasi contenuto che potrebbe essere eliminato. | ||
\* * *| Il sistema operativo può cancellare il contenuto di questa directory ogni volta che si sente è necessario, ma non fare affidamento su questo. Si dovrebbe cancellare questa directory come adatto per l'applicazione. | ||
* * *| Il sistema operativo può cancellare il contenuto di questa directory ogni volta che si sente è necessario, ma non fare affidamento su questo. Si dovrebbe cancellare questa directory come adatto per l'applicazione. | ||
@@ -110,0 +110,0 @@ ### Layout sistema Android File |
@@ -99,4 +99,4 @@ <!--- | ||
| `Cloud/` | syncedDataDirectory | - | r/w | はい | いいえ | はい | はい | | ||
| `Caches/` | cacheDirectory | キャッシュ | r/w | はい * | はい \* * *| | いいえ | はい | | ||
| `tmp/` | tempDirectory | - | r/w | いいえ * * | はい \* * *| | いいえ | はい | | ||
| `Caches/` | cacheDirectory | キャッシュ | r/w | はい * | はい * * *| | いいえ | はい | | ||
| `tmp/` | tempDirectory | - | r/w | いいえ * * | はい * * *| | いいえ | はい | | ||
@@ -107,3 +107,3 @@ * アプリを再起動し、アップグレードとの間でファイルを保持が、OS を希望するたびにこのディレクトリを削除することができます。アプリを削除可能性があります任意のコンテンツを再作成することができる必要があります。 | ||
\* * *| OS はそれ、必要だと感じているときにこのディレクトリの内容を消去可能性がありますが、これに依存しません。 この適切なディレクトリに、アプリケーションをオフにする必要があります。 | ||
* * *| OS はそれ、必要だと感じているときにこのディレクトリの内容を消去可能性がありますが、これに依存しません。 この適切なディレクトリに、アプリケーションをオフにする必要があります。 | ||
@@ -110,0 +110,0 @@ ### 人造人間ファイル ・ システム ・ レイアウト |
@@ -99,4 +99,4 @@ <!--- | ||
| `Cloud/` | syncedDataDirectory | - | r/w | 예 | 없음 | 예 | 예 | | ||
| `Caches/` | cacheDirectory | 캐시 | r/w | 예 * | 예 \* * *| | 없음 | 예 | | ||
| `tmp/` | tempDirectory | - | r/w | 아니 * * | 예 \* * *| | 없음 | 예 | | ||
| `Caches/` | cacheDirectory | 캐시 | r/w | 예 * | 예 * * *| | 없음 | 예 | | ||
| `tmp/` | tempDirectory | - | r/w | 아니 * * | 예 * * *| | 없음 | 예 | | ||
@@ -107,3 +107,3 @@ * 파일 응용 프로그램 다시 시작 및 업그레이드, 유지 하지만 OS 욕망 언제 든 지이 디렉터리를 지울 수 있습니다. 앱 삭제 될 수 있습니다 모든 콘텐츠를 다시 만들 수 있어야 합니다. | ||
\* * *| OS 그것이 필요를 느낀다 언제 든 지이 디렉터리의 내용을 취소 될 수 있습니다 하지만 이것에 의존 하지 마십시오. 이 디렉터리를 응용 프로그램에 대 한 적절 한 선택을 취소 해야 합니다. | ||
* * *| OS 그것이 필요를 느낀다 언제 든 지이 디렉터리의 내용을 취소 될 수 있습니다 하지만 이것에 의존 하지 마십시오. 이 디렉터리를 응용 프로그램에 대 한 적절 한 선택을 취소 해야 합니다. | ||
@@ -110,0 +110,0 @@ ### 안 드 로이드 파일 시스템 레이아웃 |
@@ -38,3 +38,3 @@ <!--- | ||
## Instalacji | ||
## Instalacja | ||
@@ -46,5 +46,5 @@ cordova plugin add org.apache.cordova.file | ||
* Amazon ogień OS | ||
* Amazon Fire OS | ||
* Android | ||
* Jeżyna 10 | ||
* BlackBerry 10 | ||
* Firefox OS | ||
@@ -101,4 +101,4 @@ * iOS | ||
| `Cloud/` | syncedDataDirectory | - | r/w | Tak | Nr | Tak | Tak | | ||
| `Caches/` | cacheDirectory | pamięci podręcznej | r/w | Tak * | Tak \* * *| | Nr | Tak | | ||
| `tmp/` | tempDirectory | - | r/w | Nie * * | Tak \* * *| | Nr | Tak | | ||
| `Caches/` | cacheDirectory | pamięci podręcznej | r/w | Tak * | Tak * * *| | Nr | Tak | | ||
| `tmp/` | tempDirectory | - | r/w | Nie * * | Tak * * *| | Nr | Tak | | ||
@@ -109,3 +109,3 @@ * Pliki utrzymywały aplikacja zostanie ponownie uruchomiony i uaktualnienia, ale w tym katalogu mogą być rozliczone, gdy OS pragnienia. Aplikacji powinny być w stanie odtworzyć zawartość, która może być usunięta. | ||
\* * *| System operacyjny może wyczyścić zawartość w tym katalogu, gdy czuje, że jest to konieczne, ale nie powoływać się na to. Należy wyczyścić ten katalog jako odpowiednie dla aplikacji. | ||
* * *| System operacyjny może wyczyścić zawartość w tym katalogu, gdy czuje, że jest to konieczne, ale nie powoływać się na to. Należy wyczyścić ten katalog jako odpowiednie dla aplikacji. | ||
@@ -145,3 +145,3 @@ ### Układ systemu Android plików | ||
## Android dziwactwa | ||
## Dziwactwa Androida | ||
@@ -171,3 +171,3 @@ ### Lokalizacja przechowywania trwałych Android | ||
## iOS dziwactwa | ||
## Dziwactwa iOS | ||
@@ -174,0 +174,0 @@ * `cordova.file.applicationStorageDirectory`jest tylko do odczytu; próby przechowywania plików w katalogu głównym zakończy się niepowodzeniem. Użyj jednego z innych `cordova.file.*` właściwości zdefiniowane dla iOS (tylko `applicationDirectory` i `applicationStorageDirectory` są tylko do odczytu). |
@@ -45,3 +45,3 @@ <!--- | ||
* Amazon Fire ОС | ||
* Amazon Fire OS | ||
* Android | ||
@@ -100,4 +100,4 @@ * BlackBerry 10 | ||
| `Cloud/` | syncedDataDirectory | - | r/w | Да | Нет | Да | Да | | ||
| `Caches/` | cacheDirectory | кэш | r/w | Да * | Да \* * *| | Нет | Да | | ||
| `tmp/` | tempDirectory | - | r/w | Не * * | Да \* * *| | Нет | Да | | ||
| `Caches/` | cacheDirectory | кэш | r/w | Да * | Да * * *| | Нет | Да | | ||
| `tmp/` | tempDirectory | - | r/w | Не * * | Да * * *| | Нет | Да | | ||
@@ -108,3 +108,3 @@ * Файлы сохраняются приложения перезагрузки и обновления, но этот каталог может быть очищен, когда ОС желаний. Ваше приложение должно иметь возможность воссоздать любое содержание, которое может быть удалено. | ||
\* * *| ОС может очистить содержимое этого каталога, когда он считает это необходимым, но не полагайтесь на это. Необходимо снять этот каталог в зависимости от вашего приложения. | ||
* * *| ОС может очистить содержимое этого каталога, когда он считает это необходимым, но не полагайтесь на это. Необходимо снять этот каталог в зависимости от вашего приложения. | ||
@@ -144,3 +144,3 @@ ### Расположения Android файловой системы | ||
## Android причуды | ||
## Особенности Android | ||
@@ -170,3 +170,3 @@ ### Местоположение Android постоянного хранения | ||
## iOS причуды | ||
## Особенности iOS | ||
@@ -194,3 +194,3 @@ * `cordova.file.applicationStorageDirectory`доступен только для чтения; попытка хранения файлов в корневом каталоге не удастся. Использовать один из других `cordova.file.*` свойства, определенные для iOS (только `applicationDirectory` и `applicationStorageDirectory` доступны только для чтения). | ||
## Firefox OS причуды | ||
## Особенности Firefox OS | ||
@@ -197,0 +197,0 @@ API файловой системы изначально не поддерживается Firefox OS и реализуется как оболочка поверх indexedDB. |
@@ -106,4 +106,4 @@ <!--- | ||
| `Cloud/` | syncedDataDirectory | - | r/w | 是啊 | 無 | 是啊 | 是啊 | | ||
| `Caches/` | cacheDirectory | 快取記憶體 | r/w | 是啊 * | 是的 \* * *| | 無 | 是啊 | | ||
| `tmp/` | tempDirectory | - | r/w | 沒有 * * | 是的 \* * *| | 無 | 是啊 | | ||
| `Caches/` | cacheDirectory | 快取記憶體 | r/w | 是啊 * | 是的 * * *| | 無 | 是啊 | | ||
| `tmp/` | tempDirectory | - | r/w | 沒有 * * | 是的 * * *| | 無 | 是啊 | | ||
@@ -114,3 +114,3 @@ * 檔堅持跨應用程式重新開機和升級,但是每當 OS 的欲望,可以清除此目錄。您的應用程式應該能夠重新創建任何內容可能會被刪除。 | ||
\* * *| OS 可能會清除此目錄的內容,每當它感覺它是必要的但不是依賴于此。 你應該清除此目錄為適合您的應用程式。 | ||
* * *| OS 可能會清除此目錄的內容,每當它感覺它是必要的但不是依賴于此。 你應該清除此目錄為適合您的應用程式。 | ||
@@ -117,0 +117,0 @@ ### Android 的檔案系統佈局 |
{ | ||
"name": "cordova-plugin-file", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Cordova File Plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -278,1 +278,19 @@ <!-- | ||
* CB-7094 Ported File manual tests | ||
### 1.3.2 (Dec 02, 2014) | ||
* Gets rid of thread block error in File plugin | ||
* CB-7917 Made tests file.spec.114 - 116 pass for **Windows** platform | ||
* CB-7977 Mention `deviceready` in plugin docs | ||
* CB-7602: Fix `isCopyOnItself` logic | ||
* CB-7700 cordova-plugin-file documentation translation: cordova-plugin-file | ||
* Use one proxy for both **Windows** and **Windows8** platforms | ||
* CB-6994 Fixes result, returned by proxy's write method | ||
* [fxos] update `__format__` to match `pathsPrefix` | ||
* CB-6994 Improves merged code to be able to write a File | ||
* Optimize `FileProxy` for **Windows** platforms | ||
* Synchronize changes with **Windows** platform | ||
* Fix function write for big files on **Windows 8** | ||
* Write file in background | ||
* CB-7487 **Android** Broadcast file write This allows MTP USB shares to show the file immediately without reboot/manual refresh using 3rd party app. | ||
* CB-7700 cordova-plugin-file documentation translation: cordova-plugin-file | ||
* CB-7571 Bump version of nested plugin to match parent plugin |
@@ -64,3 +64,27 @@ /* | ||
var writeBytesAsync = Windows.Storage.FileIO.writeBytesAsync; | ||
var writeTextAsync = Windows.Storage.FileIO.writeTextAsync; | ||
var writeBlobAsync = function writeBlobAsync(storageFile, data) { | ||
return storageFile.openAsync(Windows.Storage.FileAccessMode.readWrite) | ||
.then(function (output) { | ||
var dataSize = data.size; | ||
var input = (data.detachStream || data.msDetachStream).call(data); | ||
// Copy the stream from the blob to the File stream | ||
return Windows.Storage.Streams.RandomAccessStream.copyAsync(input, output) | ||
.then(function () { | ||
return output.flushAsync().then(function () { | ||
input.close(); | ||
output.close(); | ||
return dataSize; | ||
}); | ||
}); | ||
}); | ||
}; | ||
var writeArrayBufferAsync = function writeArrayBufferAsync(storageFile, data) { | ||
return writeBlobAsync(storageFile, new Blob([data])); | ||
}; | ||
module.exports = { | ||
@@ -329,8 +353,5 @@ | ||
getFileFromPathAsync(fullPath).then( | ||
function (sFile) { | ||
getFileFromPathAsync(fullPath).done(function (storageFile) { | ||
function (storageFile) { | ||
storageFile.deleteAsync().done(win, function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}); | ||
}); | ||
@@ -520,35 +541,55 @@ }, | ||
if (data instanceof ArrayBuffer) { | ||
data = Array.apply(null, new Uint8Array(data)); | ||
} | ||
var writePromise = isBinary ? Windows.Storage.FileIO.writeBytesAsync : Windows.Storage.FileIO.writeTextAsync; | ||
fileName = fileName.split("/").join("\\"); | ||
// split path to folder and file name | ||
var path = fileName.substring(0, fileName.lastIndexOf('\\')), | ||
file = fileName.split('\\').pop(); | ||
function getWriteMethodForData(data, isBinary) { | ||
if (data instanceof Blob) { | ||
return writeBlobAsync; | ||
} | ||
if (data instanceof ArrayBuffer) { | ||
return writeArrayBufferAsync; | ||
} | ||
if (isBinary) { | ||
return writeBytesAsync; | ||
} | ||
if (typeof data === 'string') { | ||
return writeTextAsync; | ||
} | ||
throw new Error('Unsupported data type for write method'); | ||
} | ||
var writePromise = getWriteMethodForData(data, isBinary); | ||
getFolderFromPathAsync(path).done( | ||
function(storageFolder) { | ||
function (storageFolder) { | ||
storageFolder.createFileAsync(file, Windows.Storage.CreationCollisionOption.openIfExists).done( | ||
function(storageFile) { | ||
writePromise(storageFile, data). | ||
done(function () { | ||
win(data.length); | ||
}, function () { | ||
function (storageFile) { | ||
writePromise(storageFile, data).done( | ||
function (bytesWritten) { | ||
var written = bytesWritten || data.length; | ||
win(written); | ||
}, | ||
function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
}); | ||
}, function() { | ||
} | ||
); | ||
}, | ||
function () { | ||
fail(FileError.INVALID_MODIFICATION_ERR); | ||
} | ||
); | ||
}, function() { | ||
}, | ||
function () { | ||
fail(FileError.NOT_FOUND_ERR); | ||
}); | ||
} | ||
); | ||
}, | ||
@@ -555,0 +596,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* | ||
/* | ||
* | ||
@@ -102,6 +102,7 @@ * Licensed to the Apache Software Foundation (ASF) under one | ||
var supportsBinary = (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined'); | ||
var isProxySupportBlobNatively = (cordova.platformId === "windows8" || cordova.platformId === "windows"); | ||
var isBinary; | ||
// Check to see if the incoming data is a blob | ||
if (data instanceof File || (supportsBinary && data instanceof Blob)) { | ||
if (data instanceof File || (!isProxySupportBlobNatively && supportsBinary && data instanceof Blob)) { | ||
var fileReader = new FileReader(); | ||
@@ -122,3 +123,3 @@ fileReader.onload = function() { | ||
isBinary = supportsBinary && (data instanceof ArrayBuffer); | ||
if (isBinary && ['windowsphone', 'windows8'].indexOf(cordova.platformId) >= 0) { | ||
if (isBinary && cordova.platformId === "windowsphone") { | ||
// create a plain array, using the keys from the Uint8Array view so that we can serialize it | ||
@@ -125,0 +126,0 @@ data = Array.apply(null, new Uint8Array(data)); |
@@ -22,3 +22,3 @@ /* | ||
FILESYSTEM_PREFIX = "cdvfile://"; | ||
FILESYSTEM_PREFIX = "file:///"; | ||
@@ -25,0 +25,0 @@ module.exports = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1029983
106
10775