Github user sgrebnov commented on a diff in the pull request:
https://github.com/apache/cordova-plugin-file/pull/54#discussion_r18519099
--- Diff: src/windows/FileProxy.js ---
@@ -518,36 +518,69 @@ module.exports = {
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();
-
getFolderFromPathAsync(path).done(
function(storageFolder) {
storageFolder.createFileAsync(file,
Windows.Storage.CreationCollisionOption.openIfExists).done(
function(storageFile) {
- writePromise(storageFile, data).
- done(function () {
- win(data.length);
- }, function () {
- fail(FileError.INVALID_MODIFICATION_ERR);
- });
- }, function() {
+ if (data instanceof Blob || data instanceof File) {
+
storageFile.openAsync(Windows.Storage.FileAccessMode.readWrite).done(
+ function (output) {
+ var input = data.msDetachStream();
--- End diff --
Try the following test: file.spec.106 should be able to write a File to a
FileWriter
https://github.com/apache/cordova-plugin-file/blob/master/tests/tests.js#L2464
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]