Uploading a buffer to google cloud storage

后端 未结 4 608
无人及你
无人及你 2021-02-07 06:27

I\'m trying to save a Buffer (of a file uploaded from a form) to Google Cloud storage, but it seems like the Google Node SDK only allows files with a given path to be uploaded (

4条回答
  •  遥遥无期
    2021-02-07 06:59

    We have an issue about supporting this more easily: https://github.com/GoogleCloudPlatform/gcloud-node/issues/1179

    But for now, you can try:

    file.createWriteStream()
      .on('error', function(err) {})
      .on('finish', function() {})
      .end(fileContents);
    

提交回复
热议问题