UNPKG

unenv

Version:

`unenv` is a framework-agnostic system that allows converting JavaScript code to be platform agnostic and work in any environment including Browsers, Workers, Node.js, or JavaScript runtime.

86 lines (85 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SocketAddress = exports.Socket = void 0; var _duplex = require("../stream/duplex.cjs"); class Socket extends _duplex.Duplex { __unenv__ = true; bufferSize = 0; bytesRead = 0; bytesWritten = 0; connecting = false; destroyed = false; pending = false; localAddress = ""; localPort = 0; remoteAddress = ""; remoteFamily = ""; remotePort = 0; autoSelectFamilyAttemptedAddresses = []; readyState = "readOnly"; constructor(_options) { super(); } write(_buffer, _arg1, _arg2) { return false; } connect(_arg1, _arg2, _arg3) { return this; } end(_arg1, _arg2, _arg3) { return this; } setEncoding(_encoding) { return this; } pause() { return this; } resume() { return this; } setTimeout(_timeout, _callback) { return this; } setNoDelay(_noDelay) { return this; } setKeepAlive(_enable, _initialDelay) { return this; } address() { return {}; } unref() { return this; } ref() { return this; } destroySoon() { this.destroy(); } resetAndDestroy() { const err = new Error("ERR_SOCKET_CLOSED"); err.code = "ERR_SOCKET_CLOSED"; this.destroy(err); return this; } } exports.Socket = Socket; class SocketAddress { __unenv__ = true; address; family; port; flowlabel; constructor(options) { this.address = options.address; this.family = options.family; this.port = options.port; this.flowlabel = options.flowlabel; } } exports.SocketAddress = SocketAddress;