Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for streaming of files upload #258

Open
MarcDanjou opened this issue Mar 8, 2024 · 1 comment
Open

Support for streaming of files upload #258

MarcDanjou opened this issue Mar 8, 2024 · 1 comment

Comments

@MarcDanjou
Copy link

MarcDanjou commented Mar 8, 2024

Hello there, thanks for this awesome package. I am currently using it in a docker-compose env + a nodejs fastify application running on node 20.

I am trying to stream a file upload to a bucket, following the samples from google there ==> https://github.com/googleapis/nodejs-storage/blob/main/samples/streamFileUpload.js

  // Creates a client
  const storage = new Storage();

  // Get a reference to the bucket
  const myBucket = storage.bucket(bucketName);

  // Create a reference to a file object
  const file = myBucket.file(destFileName);

  // Create a pass through stream from a string
  const passthroughStream = new stream.PassThrough();
  passthroughStream.write(contents);
  passthroughStream.end();

  async function streamFileUpload() {
    passthroughStream.pipe(file.createWriteStream()).on('finish', () => {
      // The file upload is complete
    });

    console.log(`${destFileName} uploaded to ${bucketName}`);
  }

  streamFileUpload().catch(console.error);

But at every call, I am receiving this error ==>
'NoneType' object is not callable

image

I did the same test using a real bucket on Google cloud storage and it works flawlessly, I guess this is related to some methods not implemented yet in this emulator nope ?

Thanks again 👍

@System-Glitch
Copy link

Same issue here. I tried with the following cURL request:

curl --location 'http://localhost:9023/storage/v1/b/test-bucket/o?uploadType=multipart' \
--header 'Content-Type: multipart/related; boundary=separator_string' \
--data '--separator_string
Content-Type: application/json; charset=UTF-8

{"name":"my-document.txt"}

--separator_string
Content-Type: text/plain

This is a text file.
--separator_string--'

I was using this documentation as a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants