[
https://issues.apache.org/jira/browse/CB-6994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14161875#comment-14161875
]
ASF GitHub Bot commented on CB-6994:
------------------------------------
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
> Windows 8 does not save big file transferred using Blob
> -------------------------------------------------------
>
> Key: CB-6994
> URL: https://issues.apache.org/jira/browse/CB-6994
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin File, Windows 8
> Affects Versions: 3.5.0
> Reporter: Maxime LUCE
> Assignee: Maxime LUCE
> Fix For: 3.6.0
>
>
> When trying to save Blob using FileWriter.write method, if the blob's size is
> too high, we get a stack overflow exception during the conversion of the blob
> into an basic array.
> WinRT (WinJS) provide a method to write Blob directly to the filesystem. It
> uses Streams so it's safe for memory.
> More info at :
> http://code.msdn.microsoft.com/windowsapps/Blob-Sample-0e35889e/sourcecode?fileId=43594&pathId=962515806
> Method : writeBlobToFile
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]