How to resumable upload with google drive node.js

后端 未结 2 1150
说谎
说谎 2021-01-16 06:42

Hey since google drive was changing their library I´am not able to upload anymore files bigger than 5MB with the basic upload drive.files.create. The docs t

相关标签:
2条回答
  • 2021-01-16 07:28

    In other api clients (e.g. the Python one), resumable uploads are created by altering the MediaFileUpload constructor with the parameter resumable=True. The node.js api client is only in alpha, so it may not have built-in support for resumable uploads. You can try feeding drive a stream, or simply extending that example media parameter, e.g.

    media: {
      mimeType: 'some mimetype',
      body: 'some body',
      resumable: true
    }
    

    If stream and the above resumable don't work, then you won't be able to use the node.js client library to do resumable uploads, and will have to use the REST API directly.

    0 讨论(0)
  • 2021-01-16 07:30

    The problem itself was related to the googleapi library for node.js. With v27.0.0 the basic upload was working again for big files aswell. Related to: https://github.com/google/google-api-nodejs-client/issues/1038

    This is not an answer for how to resumable upload with node.js so you may keep this topic open until somebody post a sample code for resumable upload because even with v27 my POST request is still not working. Maybe you watch the github link from above because I asked there aswell for an sample code.

    However my problem was only that I was not able to upload bigger files than 5MB. But this problem is now gone for me :)!

    0 讨论(0)
提交回复
热议问题