Giter Site home page Giter Site logo

Comments (2)

mstange avatar mstange commented on August 16, 2024 1

Ah, that means I misunderstood how it works and need to do some more debugging. Thanks for taking a look!

from compression.

saschanaz avatar saschanaz commented on August 16, 2024

As specced, when the compressed data comes from the network, the browser has to decompress it all and enqueue the decompressed chunks.

Can you show me how you are using the stream? TransformStreams are not supposed to consume greedily and has highWaterMark=1, meaning it's only allowed to have one single unconsumed chunk and then stops processing until it's read.

With the following demo it only reads the first chunk and wait.

// A string "HELLO"
let buffer = [
  new Uint8Array([31,139,8,0,0]),
  new Uint8Array([0,0,0,0,10]),
  new Uint8Array([243,112,245,241,241]),
  new Uint8Array([7,0,54,100,68,193,5,0,0,0]),
];
let index = 0;
let r = new ReadableStream({
  pull(controller) {
    if (index >= buffer.length) {
      controller.close();
      return;
    }
    console.log("pulled", index);
    controller.enqueue(buffer[index]);
    ++index;
  },
  type: "bytes"
});
let d = new DecompressionStream("gzip");
let pipe = r.pipeThrough(d);

Please correct me if I misunderstood your issue.

from compression.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.