Skip to content

Ensure the JS thread doesn't have to get hit when piping two streams to each other #97

Closed
@domenic

Description

@domenic

E.g., an XHR stream to a file system stream, xhrStream.pipeTo(fsStream).

As-is, there might be a problem if e.g. the user does

var oldWrite = fsStream.write;
fsStream.write = function (chunk) {
  console.log("AOP logging!!", chunk);
  oldWrite.apply(this, arguments);
};

after the pipe is already set up. The implementation would have to detect this and start routing data to the main thread, which kind of sucks.

A possible fix would be caching the value of dest.write at the top of pipeTo.

/cc @sicking

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions