File creation is ignoring my parameters but creates an “Untitled” binary file

南楼画角 提交于 2019-12-11 23:45:48

问题


Using the Google API via the googleapis package and the file.create call simply does not work. I've experimented making the same call in Google's API Explorer and it does work. I'm at a bit of a loss.

The createSheet call is encapsulated as follows :

Google.prototype.createSheet = function(filename, callback) {
    var services = google.drive('v3');
    services.files.create({
      "name"     : filename,
      "mimeType" : "application/vnd.google-apps.spreadsheet",
      "description" : 'auto-generated by the cli',
      "auth"     : this.auth
    }, function(err,response) {
      if( err ) {
        console.log('Error : unable to create file, ' + err);
        return;
      } else {
        console.dir(response);
      }
    });
}

... the net result is,

{ kind: 'drive#file',
  id: '0BwWAQdfAgbYzWk5XRFQyODQ0Zmc',
  name: 'Untitled',
  mimeType: 'application/octet-stream' 
}

It's missing both the filename as well as the filetype.

The general framework here is working correctly as I can get a list of files and read from spreadsheets.

来源:https://stackoverflow.com/questions/40414569/file-creation-is-ignoring-my-parameters-but-creates-an-untitled-binary-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!