分段上传后文件内容不正确

时间:2015-05-20 12:29:50

标签: node.js multipartform-data filepicker.io

我正在尝试使用Filepicker API和request.js模块将文件上传到S3。

content = "ABCDEF"
options =
  url: 'https://www.filepicker.io/api/store/S3'
  preambleCRLF: true # tried also with false
  postambleCRLF: true # tried also with false
  qs:
    key: 'XXX'
    store: 'S3'
    mimetype: 'text/csv'
    path: 'some-path.csv'
    container: 'my-bucket'
    access: 'public'
    multipart: [
      {
        body: content
      }
    ]
    method: 'post'

request options, (err, res, body) ->
  # 200 OK

它通常有效,但上传的文件内容如下所示:

--6f63ec28-40de-425c-86d5-36f0befcec4a
ABCDEF
--6f63ec28-40de-425c-86d5-36f0befcec4a--

我做错了什么?

1 个答案:

答案 0 :(得分:1)

此请求的主要问题是您已将多部分选项放在querystring参数中。对我有用的请求是:

A = LOAD 'a.csv' AS (bank_details:map[{(name:chararray)}]);
B = FOREACH A GENERATE FLATTEN(bank_details#'banks') AS bank_name;

dump B;
(bofa)
(chase)