--- /dev/null
+../../../ts/node/
\ No newline at end of file
--- /dev/null
+../../ts
\ No newline at end of file
--- /dev/null
+// Minimal part of the Node API which we depend on.
+// May be (c) Microsoft licensed under the MIT license, however API's are not generally copyrightable per recent precedent.
+declare module 'buffer' {
+ global {
+ interface Buffer extends Uint8Array {}
+ }
+}
+declare module 'node:buffer' {
+ export * from 'buffer';
+}
// May be (c) Microsoft licensed under the MIT license, however API's are not generally copyrightable per recent precedent.
declare module 'crypto' {
namespace webcrypto {
- function getRandomValues(TypedArray): void;
+ function getRandomValues(out: Uint8Array): void;
}
}
declare module 'node:crypto' {
// Minimal part of the Node fs API which we depend on.
// May be (c) Microsoft licensed under the MIT license, however API's are not generally copyrightable per recent precedent.
declare module 'fs' {
- export type PathLike = string | Buffer | URL;
+ export type PathLike = string | URL;
export type PathOrFileDescriptor = PathLike | number;
export function readFileSync(
path: PathOrFileDescriptor,
// Minimal part of the Node API which we depend on.
// May be (c) Microsoft licensed under the MIT license, however API's are not generally copyrightable per recent precedent.
+/// <reference path="buffer.d.ts" />
/// <reference path="crypto.d.ts" />
/// <reference path="fs.d.ts" />
+/// <reference path="stream.d.ts" />
+/// <reference path="net.d.ts" />
--- /dev/null
+// Minimal part of the Node fs API which we depend on.
+// May be (c) Microsoft licensed under the MIT license, however API's are not generally copyrightable per recent precedent.
+declare module 'net' {
+ import * as stream from 'node:stream';
+ class Socket extends stream.Duplex {
+ constructor();
+ write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
+ connect(port: number, host: string, connectionListener?: () => void): this;
+ pause(): this;
+ resume(): this;
+ setNoDelay(noDelay?: boolean): this;
+ readonly remoteAddress?: string | undefined;
+ readonly remotePort?: number | undefined;
+ on(event: 'close', listener: (hadError: boolean) => void): this;
+ on(event: 'connect', listener: () => void): this;
+ on(event: 'data', listener: (data: Buffer) => void): this;
+ on(event: 'drain', listener: () => void): this;
+ on(event: 'error', listener: (err: Error) => void): this;
+ }
+ class Server {
+ listen(port?: number, hostname?: string, listeningListener?: () => void): this;
+ close(callback?: (err?: Error) => void): this;
+ on(event: 'error', listener: (err: Error) => void): this;
+ on(event: 'listening', listener: () => void): this;
+ }
+ function createServer(connectionListener?: (socket: Socket) => void): Server;
+ function isIPv4(input: string): boolean;
+ function isIPv6(input: string): boolean;
+}
+declare module 'node:net' {
+ export * from 'net';
+}
--- /dev/null
+/**
+ * A stream is an abstract interface for working with streaming data in Node.js.
+ * The `stream` module provides an API for implementing the stream interface.
+ *
+ * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances.
+ *
+ * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`.
+ *
+ * To access the `stream` module:
+ *
+ * ```js
+ * const stream = require('stream');
+ * ```
+ *
+ * The `stream` module is useful for creating new types of stream instances. It is
+ * usually not necessary to use the `stream` module to consume streams.
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/stream.js)
+ */
+declare module 'stream' {
+ namespace internal {
+ class Stream {}
+ class Readable extends Stream {
+ destroy(error?: Error): this;
+ }
+ class Writable extends Stream {
+ destroy(error?: Error): this;
+ }
+ class Duplex extends Readable implements Writable {}
+ }
+ export = internal;
+}
+declare module 'node:stream' {
+ import stream = require('stream');
+ export = stream;
+}