Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/packages/protocol/src/browser/modules/net.ts
Kyle Carberry a328204d80
Implement fs module (#3)
* Implements the fs module

* Add stats object

* Add not implemented to createWriteStream

* Update mkdtemp to use tmp dir

* Unexport Stats

* Add client web socket for commands and restructure
2019-02-05 11:15:47 -06:00

73 lines
1.4 KiB
TypeScript

import * as net from "net";
/**
* Implementation of Socket for the browser.
*/
class Socket extends net.Socket {
public connect(): this {
throw new Error("not implemented");
}
}
/**
* Implementation of Server for the browser.
*/
class Server extends net.Server {
public listen(
_port?: number | any | net.ListenOptions, // tslint:disable-line no-any so we can match the Node API.
_hostname?: string | number | Function,
_backlog?: number | Function,
_listeningListener?: Function,
): this {
throw new Error("not implemented");
}
}
type NodeNet = typeof net;
/**
* Implementation of net for the browser.
*/
export class Net implements NodeNet {
public get Socket(): typeof net.Socket {
return Socket;
}
public get Server(): typeof net.Server {
return Server;
}
public connect(): net.Socket {
throw new Error("not implemented");
}
public createConnection(): net.Socket {
throw new Error("not implemented");
}
public isIP(_input: string): number {
throw new Error("not implemented");
}
public isIPv4(_input: string): boolean {
throw new Error("not implemented");
}
public isIPv6(_input: string): boolean {
throw new Error("not implemented");
}
public createServer(
_options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean } | ((socket: net.Socket) => void),
_connectionListener?: (socket: net.Socket) => void,
): Server {
return new Server();
}
}