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

Use browser implementation of Node.js' stream library #1201

Closed
huan opened this issue May 11, 2018 · 1 comment
Closed

Use browser implementation of Node.js' stream library #1201

huan opened this issue May 11, 2018 · 1 comment

Comments

@huan
Copy link
Member

huan commented May 11, 2018

Wechaty might want to run inside the browser in the future.

Currently, the Message class need to output a File using the Stream API.

See Also

@huan
Copy link
Member Author

huan commented May 26, 2018

Mission cancelled because it seems that the ReadableStream between Node.js and DOM is not compatible.

Dom

interface ReadableStream {
    readonly locked: boolean;
    cancel(): Promise<void>;
    getReader(): ReadableStreamReader;
}

Node

    export interface ReadableStream extends EventEmitter {
        readable: boolean;
        read(size?: number): string | Buffer;
        setEncoding(encoding: string): this;
        pause(): this;
        resume(): this;
        isPaused(): boolean;
        pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
        unpipe<T extends WritableStream>(destination?: T): this;
        unshift(chunk: string): void;
        unshift(chunk: Buffer): void;
        wrap(oldStream: ReadableStream): this;
        [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
    }

@huan huan closed this as completed May 26, 2018
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

1 participant