@wocker/utils 1.0.10-beta.1 → 1.0.11-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.demuxOutput = void 0;
4
4
  const demuxOutput = (buffer) => {
5
+ function bufferSlice(end) {
6
+ const method = "subarray" in buffer ? "subarray" : "slice", out = buffer[method](0, end);
7
+ buffer = Buffer.from(buffer[method](end, buffer.length));
8
+ return out;
9
+ }
5
10
  let nextDataLength = null, output = Buffer.from([]);
6
11
  while (buffer.length > 0) {
7
12
  const header = bufferSlice(8);
@@ -9,11 +14,6 @@ const demuxOutput = (buffer) => {
9
14
  const content = bufferSlice(nextDataLength);
10
15
  output = Buffer.concat([output, content]);
11
16
  }
12
- function bufferSlice(end) {
13
- const out = (buffer.slice || buffer.subarray)(0, end);
14
- buffer = Buffer.from((buffer.slice || buffer.subarray)(end, buffer.length));
15
- return out;
16
- }
17
17
  return output;
18
18
  };
19
19
  exports.demuxOutput = demuxOutput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wocker/utils",
3
- "version": "1.0.10-beta.1",
3
+ "version": "1.0.11-beta.0",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Utils for @wocker",
6
6
  "license": "MIT",