@autonomys/asynchronous 1.4.29 → 1.4.31
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/streams/index.d.ts +3 -0
- package/dist/streams/index.d.ts.map +1 -0
- package/dist/streams/index.js +26 -0
- package/package.json +6 -2
- package/src/index.ts +1 -0
- package/src/streams/index.ts +12 -0
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./asyncGenerators"), exports);
|
|
18
18
|
__exportStar(require("./concurrency"), exports);
|
|
19
|
+
__exportStar(require("./streams"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/streams/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAG9C,wBAAsB,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAQhF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.forkStream = forkStream;
|
|
16
|
+
const stream_1 = require("stream");
|
|
17
|
+
const stream_fork_1 = __importDefault(require("stream-fork"));
|
|
18
|
+
function forkStream(stream) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const passThrough1 = new stream_1.PassThrough();
|
|
21
|
+
const passThrough2 = new stream_1.PassThrough();
|
|
22
|
+
const writable = stream_fork_1.default.fork([passThrough1, passThrough2]);
|
|
23
|
+
stream.pipe(writable);
|
|
24
|
+
return [passThrough1, passThrough2];
|
|
25
|
+
});
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomys/asynchronous",
|
|
3
3
|
"packageManager": "yarn@4.7.0",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.31",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/jest": "^29.5.14",
|
|
25
|
+
"@types/stream-fork": "^1",
|
|
25
26
|
"eslint": "^9.25.1",
|
|
26
27
|
"interface-store": "^6.0.2",
|
|
27
28
|
"jest": "^29.7.0",
|
|
@@ -29,5 +30,8 @@
|
|
|
29
30
|
"ts-jest": "^29.3.1",
|
|
30
31
|
"typescript": "^5.8.3"
|
|
31
32
|
},
|
|
32
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "1b164e294119b9e9beb49dd66be9a501a75bcf22",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"stream-fork": "^1.0.5"
|
|
36
|
+
}
|
|
33
37
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PassThrough, Readable } from 'stream'
|
|
2
|
+
import streamFork from 'stream-fork'
|
|
3
|
+
|
|
4
|
+
export async function forkStream(stream: Readable): Promise<[Readable, Readable]> {
|
|
5
|
+
const passThrough1 = new PassThrough()
|
|
6
|
+
const passThrough2 = new PassThrough()
|
|
7
|
+
const writable = streamFork.fork([passThrough1, passThrough2])
|
|
8
|
+
|
|
9
|
+
stream.pipe(writable)
|
|
10
|
+
|
|
11
|
+
return [passThrough1, passThrough2]
|
|
12
|
+
}
|