Skip to content

Commit

Permalink
clean up old code
Browse files Browse the repository at this point in the history
  • Loading branch information
cjihrig committed Aug 31, 2022
1 parent 8761118 commit c69f914
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 391 deletions.
5 changes: 3 additions & 2 deletions node/_stream.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// Forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4f538975138678878fed5b2555c0672aa578ab7d/types/node/stream.d.ts

import { Buffer } from "./_buffer.d.ts";
import { Abortable, EventEmitter } from "./_events.d.ts";
import {
Buffered,
Expand Down Expand Up @@ -1477,5 +1478,5 @@ interface Pipe {
}

// These have to be at the bottom of the file to work correctly, for some reason
export { _uint8ArrayToBuffer } from "./internal/streams/_utils.ts";
export { isUint8Array as _isUint8Array } from "./internal/util/types.ts";
export function _uint8ArrayToBuffer(chunk: Uint8Array): Buffer;
export function _isUint8Array(value: unknown): value is Uint8Array;
26 changes: 1 addition & 25 deletions node/_stream.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ERR_STREAM_PREMATURE_CLOSE,
} from "./internal/errors.ts";
import { destroy } from "./internal/streams/destroy.mjs";
import { isReadableEnded, isWritableEnded } from "./internal/streams/utils.mjs";
import { validateBoolean, validateObject } from "./internal/validators.mjs";

let process = __Process$;
Expand All @@ -34,31 +35,6 @@ function isWritableStream(object) {
return object instanceof WritableStream;
}

function isReadableEnded(stream) {
if (stream.readableEnded) return true;
const rState = stream._readableState;
if (!rState || rState.errored) return false;
return rState.endEmitted || (rState.ended && rState.length === 0);
}

function isWritableNodeStream(obj) {
return !!(
obj &&
typeof obj.write === "function" &&
typeof obj.on === "function" &&
(!obj._readableState || obj._writableState?.writable !== false) // Duplex
);
}

function isWritableEnded(stream) {
if (!isWritableNodeStream(stream)) return null;
if (stream.writableEnded === true) return true;
const wState = stream._writableState;
if (wState?.errored) return false;
if (typeof wState?.ended !== "boolean") return null;
return wState.ended;
}

Readable.fromWeb = function (
readableStream,
options = {},
Expand Down
10 changes: 0 additions & 10 deletions node/internal/streams/_utils.ts

This file was deleted.

194 changes: 0 additions & 194 deletions node/internal/streams/compose.mjs

This file was deleted.

5 changes: 0 additions & 5 deletions node/internal/streams/duplexify.mjs

This file was deleted.

106 changes: 0 additions & 106 deletions node/internal/streams/from.mjs

This file was deleted.

Loading

0 comments on commit c69f914

Please sign in to comment.