How to use the cordova-plugin-file.FileUploadResult function in cordova-plugin-file

To help you get started, we’ve selected a few cordova-plugin-file examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Aricwithana / DOMLauncher2 / DOMLauncher / cordova / plugins / cordova-plugin-file-transfer / src / windows / FileTransferProxy.js View on Github external
function (result) {
                                // Update TransferOperation object with new state, delete promise property
                                // since it is not actual anymore
                                var currentUploadOp = fileTransferOps[uploadId];
                                if (currentUploadOp) {
                                    currentUploadOp.state = FileTransferOperation.DONE;
                                    currentUploadOp.promise = null;
                                }

                                var response = result.getResponseInformation();
                                var ftResult = new FileUploadResult(result.progress.bytesSent, response.statusCode, '');

                                // if server's response doesn't contain any data, then resolve operation now
                                if (result.progress.bytesReceived === 0) {
                                    successCallback(ftResult);
                                    return;
                                }

                                // otherwise create a data reader, attached to response stream to get server's response
                                var reader = new Windows.Storage.Streams.DataReader(result.getResultStreamAt(0));
                                reader.loadAsync(result.progress.bytesReceived).then(function (size) {
                                    ftResult.response = reader.readString(size);
                                    successCallback(ftResult);
                                    reader.close();
                                });
                            },
                            function (error) {
github apache / cordova-plugin-file-transfer / src / windows / FileTransferProxy.js View on Github external
function (result) {
                                // Update TransferOperation object with new state, delete promise property
                                // since it is not actual anymore
                                var currentUploadOp = fileTransferOps[uploadId];
                                if (currentUploadOp) {
                                    currentUploadOp.state = FileTransferOperation.DONE;
                                    currentUploadOp.promise = null;
                                }

                                var response = result.getResponseInformation();
                                var ftResult = new FileUploadResult(result.progress.bytesSent, response.statusCode, '');

                                // if server's response doesn't contain any data, then resolve operation now
                                if (result.progress.bytesReceived === 0) {
                                    successCallback(ftResult);
                                    return;
                                }

                                // otherwise create a data reader, attached to response stream to get server's response
                                var reader = new Windows.Storage.Streams.DataReader(result.getResultStreamAt(0));
                                reader.loadAsync(result.progress.bytesReceived).then(function (size) {
                                    ftResult.response = reader.readString(size);
                                    successCallback(ftResult);
                                    reader.close();
                                });
                            },
                            function (error) {
github apache / cordova-plugin-file-transfer / src / windows / FileTransferProxy.js View on Github external
function (result) {
            // Update TransferOperation object with new state, delete promise property
            // since it is not actual anymore
            var currentUploadOp = fileTransferOps[uploadId];
            if (currentUploadOp) {
                currentUploadOp.state = FileTransferOperation.DONE;
                currentUploadOp.promise = null;
            }

            var response = result.getResponseInformation();
            var ftResult = new FileUploadResult(result.progress.bytesSent, response.statusCode, '');

            // if server's response doesn't contain any data, then resolve operation now
            if (result.progress.bytesReceived === 0) {
                successCallback(ftResult);
                return;
            }

            // otherwise create a data reader, attached to response stream to get server's response
            var reader = new Windows.Storage.Streams.DataReader(result.getResultStreamAt(0));
            reader.loadAsync(result.progress.bytesReceived).then(function (size) {
                ftResult.response = reader.readString(size);
                successCallback(ftResult);
                reader.close();
            });
        },
        function (error) {
github AitonGoldman / PapaScoringSoftware / 2_0_attic / front / plugins / cordova-plugin-file-transfer / src / windows / FileTransferProxy.js View on Github external
function (result) {
            // Update TransferOperation object with new state, delete promise property
            // since it is not actual anymore
            var currentUploadOp = fileTransferOps[uploadId];
            if (currentUploadOp) {
                currentUploadOp.state = FileTransferOperation.DONE;
                currentUploadOp.promise = null;
            }

            var response = result.getResponseInformation();
            var ftResult = new FileUploadResult(result.progress.bytesSent, response.statusCode, '');

            // if server's response doesn't contain any data, then resolve operation now
            if (result.progress.bytesReceived === 0) {
                successCallback(ftResult);
                return;
            }

            // otherwise create a data reader, attached to response stream to get server's response
            var reader = new Windows.Storage.Streams.DataReader(result.getResultStreamAt(0));
            reader.loadAsync(result.progress.bytesReceived).then(function (size) {
                ftResult.response = reader.readString(size);
                successCallback(ftResult);
                reader.close();
            });
        },
        function (error) {