Tumblr 的文件表示您可以发送数组或“(URL-encoded 二进制内容)”以发布照片消息。

“URL-encoded 二进制内容”实际意味着什么,我如何使用 Node 实现这一目标?

我有这个功能,我一直用来从 URL 获取文件:

function getImage (url) {
  return new RSVP.Promise((resolve, reject) => {
    Request.get({
      url: url,
      encoding: null,
    }, (err, response, body) => {
      if (!err && response && response.statusCode == 200 && body) {
        const buff = Buffer.from(body);
        return resolve(buff.toString()); 
        // I've tried all kinds of stuff here:
        // return resolve(buff.toString('hex')); //nope
        // return resolve(buff.toString('binary')); //nope
        // return resolve(buff.toString('base64')); //nope
        // return resolve(encodeURIComponent(buff.toString('hex')); //nope
        // etc.

      }
    });
  });
};

然后我使用该函数的结果来填充 POST 请求的data参数。如果我指定图像的source(url)而不是数据本身,我可以使用我的 POST 功能发送常规文本帖子和图像帖子。所以我不认为这是一个 OAuth 问题。

我得到的错误信息是:

{
  'meta': {
    'status': 400,
    'msg': 'Bad Request',
  },
  'response': { 'errors': ['Nice image, but we don\'t support that format. Try resaving it as a gif, jpg, or png.'] },
};

我发送 JPEG 和 GIF,只是不是他们想要的方式。我如何从 GET 的结果转变为 tumblr 想要的东西?