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

Feature request: sending file with a stream (creating media message with a stream) #1092

Closed
baybal opened this issue Feb 6, 2018 · 1 comment

Comments

@baybal
Copy link

baybal commented Feb 6, 2018

Current method for sending multimedia messages requires the content to be a file on the disk. I want it to be possible to send a multimedia message by passing it as a stream.

If you have 100 users who are sending 100mb files simultaneously, you have to buffer and save to fs all of that prior to sending it to weixin users. That is both inconvenient and hugely wasteful to resources if the media you are sending already comes as a stream.

During our conversation on 6/2/2018, Huan mentioned that in that case it might be impossible to guess the file mime and filename. I suggest following: in case if the stream object does not contain the common options properties like filename, contentType, and knownLenght, you can tell users to set them manually, or add additional options that will be read during MediaMessage creation.

@huan
Copy link
Member

huan commented May 26, 2018

Hello @baybal,

This feature is supported from Wechaty v0.15.57 or above versions.

You can test this by npm install wechaty@next to opt-in the development branch NPM realease.

Code example:
https://github.com/Chatie/wechaty/blob/699b3ac7fa8988507f1d4c3ad3e4ef055a2a3205/examples/ding-dong-bot.ts#L101-L111

WARNING:

You should wait for the v0.16 if you want to use Wechaty in a production environment.

The v0.15 have many breaking changes from v0.14. Please make sure you have read the CHANGELOG and be prepared to say hello to the bugs.

See Also

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

No branches or pull requests

2 participants