Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions types/stream-concat/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
20 changes: 20 additions & 0 deletions types/stream-concat/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/// <reference types="node" />

import type { Readable, Transform, TransformOptions } from "stream";

interface Options extends TransformOptions {
advanceOnClose?: boolean;
}

interface NextStream {
(): Readable | null | Promise<Readable | null>;
}

declare class StreamConcat extends Transform {
constructor(streams: Readable[] | NextStream, options?: Options);

addStream(newStream: Readable): void;
nextStream(): Promise<void>;
}

export = StreamConcat;
20 changes: 20 additions & 0 deletions types/stream-concat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"private": true,
"name": "@types/stream-concat",
"version": "2.0.9999",
"projects": [
"https://github.com/sedenardi/node-stream-concat"
],
"dependencies": {
"@types/node": "*"
},
"devDependencies": {
"@types/stream-concat": "workspace:."
},
"owners": [
{
"name": "Tomasz Pluskiewicz",
"githubUsername": "tpluscode"
}
]
}
50 changes: 50 additions & 0 deletions types/stream-concat/stream-concat-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import StreamConcat = require("stream-concat");
import { Readable } from "stream";

const test: boolean = false;
const options = {
advanceOnClose: true,
highWaterMark: 10,
objectMode: true,
};

const readable = <Readable> {};
const fromStreams: Readable = new StreamConcat([
readable,
readable,
readable,
]);
const fromStreamsWithOptions: Readable = new StreamConcat([
readable,
readable,
readable,
], options);

const fromFactory: Readable = new StreamConcat(() => {
if (test) {
return readable;
}
return null;
});
const fromFactoryWithOptions: Readable = new StreamConcat(() => {
if (test) {
return readable;
}
return null;
}, options);

const fromAsyncFactory: Readable = new StreamConcat(async () => {
if (test) {
return readable;
}
return null;
});
const fromAsyncFactoryWithOptions: Readable = new StreamConcat(async () => {
if (test) {
return readable;
}
return null;
}, options);

new StreamConcat([]).addStream(readable);
new StreamConcat([]).nextStream().then(() => {});
19 changes: 19 additions & 0 deletions types/stream-concat/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "node16",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"stream-concat-tests.ts"
]
}