Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

35 строки
743 B

  1. function BrotliInput(buffer) {
  2. this.buffer = buffer;
  3. this.pos = 0;
  4. }
  5. BrotliInput.prototype.read = function(buf, i, count) {
  6. if (this.pos + count > this.buffer.length) {
  7. count = this.buffer.length - this.pos;
  8. }
  9. for (var p = 0; p < count; p++)
  10. buf[i + p] = this.buffer[this.pos + p];
  11. this.pos += count;
  12. return count;
  13. }
  14. exports.BrotliInput = BrotliInput;
  15. function BrotliOutput(buf) {
  16. this.buffer = buf;
  17. this.pos = 0;
  18. }
  19. BrotliOutput.prototype.write = function(buf, count) {
  20. if (this.pos + count > this.buffer.length)
  21. throw new Error('Output buffer is not large enough');
  22. this.buffer.set(buf.subarray(0, count), this.pos);
  23. this.pos += count;
  24. return count;
  25. };
  26. exports.BrotliOutput = BrotliOutput;