Github user sgrebnov commented on a diff in the pull request: https://github.com/apache/cordova-plugin-file/pull/54#discussion_r18519036 --- 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 -- 1. in case of data is File it fails since File does not have msDetachStream method 2. I would also do (detachStream || msDetachStream) so that it will work in future versions
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org