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

Incomplete Example, generate error: TypeError: file.stream.pipe is no… #5714

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jhongt796
Copy link

@Jhongt796 Jhongt796 commented Jun 15, 2023

…t a function

Error when execute that example:
...\node-appwrite\lib\services\storage.js:450

        file.stream.pipe(writeStream);
                    ^

TypeError: file.stream.pipe is not a function

What does this PR do?

(Provide a description of what this PR does and why it's needed.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

…t a function

Error when execute that example:
...\node-appwrite\lib\services\storage.js:450


            file.stream.pipe(writeStream);
                        ^

TypeError: file.stream.pipe is not a function
@@ -12,10 +12,11 @@ client
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;

const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', InputFile.fromPath('/path/to/file.png', 'file.png'));
const fileStream = fs.createReadStream('/path/to/file.png')
const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', InputFile.fromPath(fileStream, 'file.png'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InputFile.fromPath() takes a path, not a stream.

Are you running this code in node? Can you provide the full stack trace and/or additional detail/context?

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

Successfully merging this pull request may close these issues.

None yet

2 participants