cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-10080) Rewrite file-transfer server not to use disk cache
Date Fri, 18 Dec 2015 14:29:46 GMT

    [ https://issues.apache.org/jira/browse/CB-10080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15063997#comment-15063997
] 

ASF GitHub Bot commented on CB-10080:
-------------------------------------

Github user dblotsky commented on a diff in the pull request:

    https://github.com/apache/cordova-labs/pull/12#discussion_r48029256
  
    --- Diff: server.js ---
    @@ -11,6 +12,54 @@ var LATIN1_SYMBOLS = '¥§©ÆÖÑøøø¼';
     var Iconv  = require('iconv').Iconv;
     var iconv = new Iconv('UTF-8', 'ISO-8859-1');
     
    +function parseMultipartForm(req, res, finishCb) {
    +    var fields = {}, files = {};
    +
    +    var busboy = new Busboy({ headers: req.headers });
    +    busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
    +        var currentFile = {};
    +        file.on('data', function(data) {
    +            currentFile.name = filename;
    +            currentFile.size = data.length;
    +        });
    +
    +        file.on('end', function() {
    +            files.file = currentFile;
    +        });
    +    });
    +
    +    busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated, encoding,
mimetype) {
    +        fields[fieldname] = val;
    +    });
    +
    +    busboy.on('finish', function() {
    +        console.log(stringify({fields: fields, files: files}));
    +
    +        finishCb(req, res, {fields: fields, files: files});
    +    });
    +
    +    busboy.on('error', function(err) {
    +        console.error('error: ' + err + ': ' + JSON.stringify(err));
    +        req.connection.destroy();
    --- End diff --
    
    Might it be better to let the caller handle the error, instead of closing the connection
as a side effect?


> Rewrite file-transfer server not to use disk cache
> --------------------------------------------------
>
>                 Key: CB-10080
>                 URL: https://issues.apache.org/jira/browse/CB-10080
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: mobile-spec
>            Reporter: Sergey Shakhnazarov
>            Assignee: Sergey Shakhnazarov
>
> See the details in https://github.com/apache/cordova-labs/pull/9



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message