├── README.md
├── server
├── .gitignore
├── .vscode
│ ├── tasks.json
│ └── launch.json
├── tsconfig.json
├── package.json
├── typings
│ ├── promise.d.ts
│ └── node
│ │ └── node.d.ts
└── src
│ └── server.ts
├── client
├── .gitignore
├── typings
│ ├── node.d.ts
│ └── vscode-typings.d.ts
├── bin
│ ├── Irony.dll
│ ├── LuaFormat.exe
│ ├── CommandLine.dll
│ └── Newtonsoft.Json.dll
├── images
│ └── lua.png
├── .vscodeignore
├── tsconfig.json
├── .vscode
│ ├── settings.json
│ ├── launch.json
│ └── tasks.json
├── src
│ ├── formatProvider.ts
│ ├── childProc.ts
│ ├── extension.ts
│ └── luaFormatter.ts
├── LICENSE
├── README.md
└── package.json
└── LICENSE
/README.md:
--------------------------------------------------------------------------------
1 | ./client/README.md
--------------------------------------------------------------------------------
/server/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | node_modules
--------------------------------------------------------------------------------
/client/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | server
3 | node_modules
--------------------------------------------------------------------------------
/client/typings/node.d.ts:
--------------------------------------------------------------------------------
1 | ///
--------------------------------------------------------------------------------
/client/bin/Irony.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GCCFeli/vscode-lua/HEAD/client/bin/Irony.dll
--------------------------------------------------------------------------------
/client/images/lua.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GCCFeli/vscode-lua/HEAD/client/images/lua.png
--------------------------------------------------------------------------------
/client/bin/LuaFormat.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GCCFeli/vscode-lua/HEAD/client/bin/LuaFormat.exe
--------------------------------------------------------------------------------
/client/bin/CommandLine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GCCFeli/vscode-lua/HEAD/client/bin/CommandLine.dll
--------------------------------------------------------------------------------
/client/typings/vscode-typings.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/client/bin/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GCCFeli/vscode-lua/HEAD/client/bin/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/client/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode/**
2 | typings/**
3 | out/test/**
4 | test/**
5 | src/**
6 | **/*.map
7 | .gitignore
8 | tsconfig.json
9 | vsc-extension-quickstart.md
10 |
--------------------------------------------------------------------------------
/server/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | "command": "npm",
4 | "isShellCommand": true,
5 | "showOutput": "silent",
6 | "args": ["run", "watch"],
7 | "isWatching": true,
8 | "problemMatcher": "$tsc-watch"
9 | }
--------------------------------------------------------------------------------
/server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES5",
4 | "module": "commonjs",
5 | "moduleResolution": "node",
6 | "sourceMap": true,
7 | "outDir": "../client/server"
8 | },
9 | "exclude": [
10 | "node_modules"
11 | ]
12 | }
--------------------------------------------------------------------------------
/client/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES5",
4 | "module": "commonjs",
5 | "moduleResolution": "node",
6 | "outDir": "out/src",
7 | "noLib": true,
8 | "sourceMap": true
9 | },
10 | "exclude": [
11 | "node_modules",
12 | "server"
13 | ]
14 | }
--------------------------------------------------------------------------------
/server/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | // List of configurations. Add new configurations or edit existing ones.
4 | "configurations": [
5 | {
6 | "name": "Attach",
7 | "type": "node",
8 | "request": "attach",
9 | "port": 6004,
10 | "sourceMaps": true,
11 | "outDir": "${workspaceRoot}/../client/server"
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/client/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "files.exclude": {
4 | "out": false // set this to true to hide the "out" folder with the compiled JS files
5 | },
6 | "search.exclude": {
7 | "out": true // set this to false to include "out" folder in search results
8 | },
9 | "typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
10 | }
--------------------------------------------------------------------------------
/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vscode-lua-server",
3 | "description": "Lua language support for VS Code (Server)",
4 | "version": "0.0.1",
5 | "author": "gccfeli",
6 | "license": "MIT",
7 | "engines": {
8 | "node": "*"
9 | },
10 | "dependencies": {
11 | "vscode-languageserver": "^1.4.1"
12 | },
13 | "devDependencies": {
14 | "typescript": "^1.8.9"
15 | },
16 | "scripts": {
17 | "compile": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc -p .",
18 | "watch": "installServerIntoExtension ../client ./package.json ./tsconfig.json && tsc --watch -p ."
19 | }
20 | }
--------------------------------------------------------------------------------
/client/src/formatProvider.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import * as vscode from 'vscode';
4 | import * as path from 'path';
5 | import {LuaFormatter} from './luaFormatter'
6 |
7 | export class LuaFormattingEditProvider implements vscode.DocumentFormattingEditProvider {
8 | private rootDir: string;
9 | private formatter: LuaFormatter;
10 |
11 | public constructor(context: vscode.ExtensionContext, outputChannel: vscode.OutputChannel) {
12 | this.rootDir = context.asAbsolutePath(".");
13 | this.formatter = new LuaFormatter(outputChannel);
14 | }
15 |
16 | public provideDocumentFormattingEdits(document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken): Thenable {
17 | var fileDir = path.dirname(document.uri.fsPath);
18 | return this.formatter.formatDocument(this.rootDir, document, options, token);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/client/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that compiles the extension and then opens it inside a new window
2 | {
3 | "version": "0.1.0",
4 | "configurations": [
5 | {
6 | "name": "Launch Extension",
7 | "type": "extensionHost",
8 | "request": "launch",
9 | "runtimeExecutable": "${execPath}",
10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
11 | "stopOnEntry": false,
12 | "sourceMaps": true,
13 | "outDir": "${workspaceRoot}/out/src",
14 | "preLaunchTask": "npm"
15 | },
16 | {
17 | "name": "Launch Tests",
18 | "type": "extensionHost",
19 | "request": "launch",
20 | "runtimeExecutable": "${execPath}",
21 | "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
22 | "stopOnEntry": false,
23 | "sourceMaps": true,
24 | "outDir": "${workspaceRoot}/out/test",
25 | "preLaunchTask": "npm"
26 | }
27 | ]
28 | }
--------------------------------------------------------------------------------
/client/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // Available variables which can be used inside of strings.
2 | // ${workspaceRoot}: the root folder of the team
3 | // ${file}: the current opened file
4 | // ${fileBasename}: the current opened file's basename
5 | // ${fileDirname}: the current opened file's dirname
6 | // ${fileExtname}: the current opened file's extension
7 | // ${cwd}: the current working directory of the spawned process
8 |
9 | // A task runner that calls a custom npm script that compiles the extension.
10 | {
11 | "version": "0.1.0",
12 |
13 | // we want to run npm
14 | "command": "npm",
15 |
16 | // the command is a shell script
17 | "isShellCommand": true,
18 |
19 | // show the output window only if unrecognized errors occur.
20 | "showOutput": "silent",
21 |
22 | // we run the custom script "compile" as defined in package.json
23 | "args": ["run", "compile", "--loglevel", "silent"],
24 |
25 | // The tsc compiler is started in watching mode
26 | "isWatching": true,
27 |
28 | // use the standard tsc in watch mode problem matcher to find compile problems in the output.
29 | "problemMatcher": "$tsc-watch"
30 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 GCCFeli
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/client/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 GCCFeli
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/client/README.md:
--------------------------------------------------------------------------------
1 | # Lua for Visual Studio Code
2 | Lua language support in Visual Studio Code. For now, only code formatting is supported.
3 |
4 | If you run into any issues, please file a bug on [GitHub](https://github.com/GCCFeli/vscode-lua/issues).
5 | Only Windows is supported now. Linux/OSX support is coming soon.
6 |
7 | #Requirements
8 | .Net Framework 4.5 or higher version
9 |
10 | #Features
11 | * Code formatting
12 |
13 | #Planned Features
14 | * Auto-completion for functions, keywords, and custom APIs
15 | * Debug
16 |
17 | #Platform Support
18 | * Windows
19 | * Linux (coming soon)
20 | * OS X (coming soon)
21 |
22 | # Change Log
23 |
24 | ## Version 0.1.0
25 | * Switch to a better code formatting engine [LuaFormat](https://github.com/GCCFeli/LuaFormat) (by [GCCFeli](https://github.com/GCCFeli/)).
26 | * Now space adjusting is supported by the new code formatting engine.
27 |
28 | ## Version 0.0.4
29 | * Bug fix: default auto complete is missing.
30 |
31 | ## Version 0.0.1
32 | * Experiment support for Lua code formatting, only indention is supported.
33 |
34 | # Source
35 | You can find the source on [Github](https://github.com/GCCFeli/vscode-lua).
36 |
37 | # License
38 | [MIT](https://raw.githubusercontent.com/GCCFeli/vscode-lua/master/LICENSE)
39 |
40 | # Contact Author
41 | Please mail to feli#gccfeli.cn
42 |
--------------------------------------------------------------------------------
/client/src/childProc.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import * as path from 'path';
4 | import * as fs from 'fs';
5 | import * as child_process from 'child_process';
6 |
7 | interface ErrorMessage {
8 | Error: string;
9 | }
10 |
11 | export function sendCommand(commandLine: string, cwd: string, includeErrorAsResponse:boolean = false): Promise {
12 | return new Promise((resolve, reject) => {
13 |
14 | child_process.exec(commandLine, { cwd: cwd }, (error, stdout, stderr) => {
15 | if (includeErrorAsResponse){
16 | return resolve(stdout + '\n' + stderr);
17 | }
18 |
19 | var hasErrors = (error && error.message.length > 0) || (stderr && stderr.length > 0);
20 | if (hasErrors && (typeof stdout !== "string" || stdout.length === 0)) {
21 | var errorMsg = stderr ? stderr + '' : error.message;
22 |
23 | if (stderr && stderr.length > 0) {
24 | let err: ErrorMessage;
25 | try {
26 | err = JSON.parse(stderr);
27 | }
28 | catch (e) {
29 | return reject("Unknown error: \n" + stderr);
30 | }
31 | return reject(err.Error);
32 | } else {
33 | return reject(error.message);
34 | }
35 | }
36 |
37 | resolve(stdout + '');
38 | });
39 | });
40 | }
41 |
--------------------------------------------------------------------------------
/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vscode-lua",
3 | "displayName": "Lua",
4 | "description": "Lua language support for VS Code",
5 | "version": "0.1.2",
6 | "publisher": "gccfeli",
7 | "license": "SEE LICENSE IN LICENSE or README.MD",
8 | "homepage": "https://github.com/gccfeli/vscode-lua/blob/master/README.md",
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/gccfeli/vscode-lua"
12 | },
13 | "bugs": {
14 | "url": "https://github.com/gccfeli/vscode-lua/issues"
15 | },
16 | "icon": "images/lua.png",
17 | "engines": {
18 | "vscode": "^0.10.10"
19 | },
20 | "categories": [
21 | "Languages"
22 | ],
23 | "activationEvents": [
24 | "onLanguage:lua"
25 | ],
26 | "main": "./out/src/extension",
27 | "contributes": {
28 | "configuration": {
29 | "type": "object",
30 | "title": "Example configuration",
31 | "properties": {
32 | "languageServerExample.maxNumberOfProblems": {
33 | "type": "number",
34 | "default": 100,
35 | "description": "Controls the maximum number of problems produced by the server."
36 | }
37 | }
38 | }
39 | },
40 | "scripts": {
41 | "vscode:prepublish": "node ./node_modules/vscode/bin/compile",
42 | "compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
43 | "postinstall": "node ./node_modules/vscode/bin/install"
44 | },
45 | "dependencies": {
46 | "vscode-languageclient": "^1.4.2"
47 | },
48 | "devDependencies": {
49 | "typescript": "^1.8.9",
50 | "vscode": "^0.11.0"
51 | }
52 | }
--------------------------------------------------------------------------------
/client/src/extension.ts:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | * ------------------------------------------------------------------------------------------ */
5 | 'use strict';
6 |
7 | import * as vscode from 'vscode';
8 | import * as path from 'path';
9 |
10 | import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind } from 'vscode-languageclient';
11 |
12 | import {LuaFormattingEditProvider} from './formatProvider';
13 |
14 | const LUA: vscode.DocumentFilter = { language: 'lua', scheme: 'file' }
15 |
16 | export function activate(context: vscode.ExtensionContext) {
17 |
18 | // The server is implemented in node
19 | let serverModule = context.asAbsolutePath(path.join('server', 'server.js'));
20 | // The debug options for the server
21 | let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] };
22 |
23 | // If the extension is launch in debug mode the debug server options are use
24 | // Otherwise the run options are used
25 | let serverOptions: ServerOptions = {
26 | run : { module: serverModule, transport: TransportKind.ipc },
27 | debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
28 | }
29 |
30 | // Options to control the language client
31 | let clientOptions: LanguageClientOptions = {
32 | // Register the server for plain text documents
33 | documentSelector: ['lua'],
34 | synchronize: {
35 | // Synchronize the setting section 'languageServerExample' to the server
36 | configurationSection: 'languageServerExample',
37 | // Notify the server about file changes to '.clientrc files contain in the workspace
38 | fileEvents: vscode.workspace.createFileSystemWatcher('**/.clientrc')
39 | }
40 | }
41 |
42 | // Create the language client and start the client.
43 | let disposable = new LanguageClient('Language Server Example', serverOptions, clientOptions).start();
44 |
45 | // Push the disposable to the context's subscriptions so that the
46 | // client can be deactivated on extension deactivation
47 | context.subscriptions.push(disposable);
48 |
49 | let outChannel = vscode.window.createOutputChannel('Lua');
50 | outChannel.clear();
51 |
52 | context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider(LUA, new LuaFormattingEditProvider(context, outChannel)));
53 | }
54 |
--------------------------------------------------------------------------------
/client/src/luaFormatter.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import * as vscode from 'vscode';
4 | import * as path from 'path';
5 | import * as fs from 'fs';
6 | import {sendCommand} from './childProc';
7 |
8 | interface FormattedCode {
9 | Text: string;
10 | }
11 |
12 | export class LuaFormatter {
13 | protected outputChannel: vscode.OutputChannel;
14 |
15 | constructor(outputChannel: vscode.OutputChannel) {
16 | this.outputChannel = outputChannel;
17 | }
18 | public formatDocument(extensionDir: string, document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken): Thenable {
19 | var exeDir = path.join(extensionDir, "bin");
20 | var luaFormatExePath = path.join(exeDir, "LuaFormat.exe");
21 |
22 | return this.provideDocumentFormattingEdits(document, options, token, exeDir, `"${luaFormatExePath}" -i "${document.uri.fsPath}"`);
23 | }
24 |
25 | protected provideDocumentFormattingEdits(document: vscode.TextDocument, options: vscode.FormattingOptions, token: vscode.CancellationToken, cwd:string, cmdLine: string): Thenable {
26 | return new Promise((resolve, reject) => {
27 | //Todo: Save the contents of the file to a temporary file and format that instead saving the actual file
28 | //This could unnecessarily trigger other behaviours
29 | document.save().then(saved=> {
30 | var filePath = document.uri.fsPath;
31 | if (!fs.existsSync(filePath)) {
32 | vscode.window.showErrorMessage(`File ${filePath} does not exist`)
33 | return resolve([]);
34 | }
35 |
36 | this.outputChannel.clear();
37 |
38 | sendCommand(cmdLine, cwd).then(data=> {
39 | var formattedText = data;
40 | if (document.getText() === formattedText) {
41 | return resolve([]);
42 | }
43 |
44 | let result: FormattedCode;
45 | try {
46 | result = JSON.parse(data);
47 | }
48 | catch (e) {
49 | // not json
50 | return resolve([]);
51 | }
52 |
53 | var range = new vscode.Range(document.lineAt(0).range.start, document.lineAt(document.lineCount - 1).range.end)
54 | var textEdit = new vscode.TextEdit(range, result.Text);
55 | resolve([textEdit]);
56 | }, errorMsg => {
57 | vscode.window.showErrorMessage(errorMsg);
58 | this.outputChannel.appendLine(errorMsg);
59 | return resolve([]);
60 | });
61 | });
62 | });
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/server/typings/promise.d.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) Microsoft Corporation. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | this file except in compliance with the License. You may obtain a copy of the
5 | License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | See the Apache Version 2.0 License for specific language governing permissions
13 | and limitations under the License.
14 | ***************************************************************************** */
15 |
16 | /**
17 | * The Thenable (E.g. PromiseLike) and Promise declarions are taken from TypeScript's
18 | * lib.core.es6.d.ts file. See above Copyright notice.
19 | */
20 |
21 | /**
22 | * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
23 | * and others. This API makes no assumption about what promise libary is being used which
24 | * enables reusing existing code without migrating to a specific promise implementation. Still,
25 | * we recommand the use of native promises which are available in VS Code.
26 | */
27 | interface Thenable {
28 | /**
29 | * Attaches callbacks for the resolution and/or rejection of the Promise.
30 | * @param onfulfilled The callback to execute when the Promise is resolved.
31 | * @param onrejected The callback to execute when the Promise is rejected.
32 | * @returns A Promise for the completion of which ever callback is executed.
33 | */
34 | then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Thenable;
35 | then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => void): Thenable;
36 | }
37 |
38 | /**
39 | * Represents the completion of an asynchronous operation
40 | */
41 | interface Promise extends Thenable {
42 | /**
43 | * Attaches callbacks for the resolution and/or rejection of the Promise.
44 | * @param onfulfilled The callback to execute when the Promise is resolved.
45 | * @param onrejected The callback to execute when the Promise is rejected.
46 | * @returns A Promise for the completion of which ever callback is executed.
47 | */
48 | then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Promise;
49 | then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => void): Promise;
50 |
51 | /**
52 | * Attaches a callback for only the rejection of the Promise.
53 | * @param onrejected The callback to execute when the Promise is rejected.
54 | * @returns A Promise for the completion of the callback.
55 | */
56 | catch(onrejected?: (reason: any) => T | Thenable): Promise;
57 | }
58 |
59 | interface PromiseConstructor {
60 | /**
61 | * Creates a new Promise.
62 | * @param executor A callback used to initialize the promise. This callback is passed two arguments:
63 | * a resolve callback used resolve the promise with a value or the result of another promise,
64 | * and a reject callback used to reject the promise with a provided reason or error.
65 | */
66 | new (executor: (resolve: (value?: T | Thenable) => void, reject: (reason?: any) => void) => void): Promise;
67 |
68 | /**
69 | * Creates a Promise that is resolved with an array of results when all of the provided Promises
70 | * resolve, or rejected when any Promise is rejected.
71 | * @param values An array of Promises.
72 | * @returns A new Promise.
73 | */
74 | all(values: Array>): Promise;
75 |
76 | /**
77 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
78 | * or rejected.
79 | * @param values An array of Promises.
80 | * @returns A new Promise.
81 | */
82 | race(values: Array>): Promise;
83 |
84 | /**
85 | * Creates a new rejected promise for the provided reason.
86 | * @param reason The reason the promise was rejected.
87 | * @returns A new rejected Promise.
88 | */
89 | reject(reason: any): Promise;
90 |
91 | /**
92 | * Creates a new rejected promise for the provided reason.
93 | * @param reason The reason the promise was rejected.
94 | * @returns A new rejected Promise.
95 | */
96 | reject(reason: any): Promise;
97 |
98 | /**
99 | * Creates a new resolved promise for the provided value.
100 | * @param value A promise.
101 | * @returns A promise whose internal state matches the provided promise.
102 | */
103 | resolve(value: T | Thenable): Promise;
104 |
105 | /**
106 | * Creates a new resolved promise .
107 | * @returns A resolved promise.
108 | */
109 | resolve(): Promise;
110 | }
111 |
112 | declare var Promise: PromiseConstructor;
113 |
--------------------------------------------------------------------------------
/server/src/server.ts:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | * ------------------------------------------------------------------------------------------ */
5 | 'use strict';
6 |
7 | import {
8 | IPCMessageReader, IPCMessageWriter,
9 | createConnection, IConnection, TextDocumentSyncKind,
10 | TextDocuments, ITextDocument, Diagnostic, DiagnosticSeverity,
11 | InitializeParams, InitializeResult, TextDocumentIdentifier,
12 | CompletionItem, CompletionItemKind
13 | } from 'vscode-languageserver';
14 |
15 | // Create a connection for the server. The connection uses Node's IPC as a transport
16 | let connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
17 |
18 | // Create a simple text document manager. The text document manager
19 | // supports full document sync only
20 | let documents: TextDocuments = new TextDocuments();
21 | // Make the text document manager listen on the connection
22 | // for open, change and close text document events
23 | documents.listen(connection);
24 |
25 | // After the server has started the client sends an initilize request. The server receives
26 | // in the passed params the rootPath of the workspace plus the client capabilites.
27 | let workspaceRoot: string;
28 | connection.onInitialize((params): InitializeResult => {
29 | workspaceRoot = params.rootPath;
30 | return {
31 | capabilities: {
32 | // Tell the client that the server works in FULL text document sync mode
33 | textDocumentSync: documents.syncKind,
34 | // Tell the client that the server support code complete
35 | // completionProvider: {
36 | // resolveProvider: true
37 | // }
38 | }
39 | }
40 | });
41 |
42 | // The content of a text document has changed. This event is emitted
43 | // when the text document first opened or when its content has changed.
44 | // documents.onDidChangeContent((change) => {
45 | // validateTextDocument(change.document);
46 | // });
47 |
48 | // The settings interface describe the server relevant settings part
49 | interface Settings {
50 | languageServerExample: ExampleSettings;
51 | }
52 |
53 | // These are the example settings we defined in the client's package.json
54 | // file
55 | interface ExampleSettings {
56 | maxNumberOfProblems: number;
57 | }
58 |
59 | // hold the maxNumberOfProblems setting
60 | let maxNumberOfProblems: number;
61 | // The settings have changed. Is send on server activation
62 | // as well.
63 | connection.onDidChangeConfiguration((change) => {
64 | let settings = change.settings;
65 | maxNumberOfProblems = settings.languageServerExample.maxNumberOfProblems || 100;
66 | // Revalidate any open text documents
67 | //documents.all().forEach(validateTextDocument);
68 | });
69 |
70 | // function validateTextDocument(textDocument: ITextDocument): void {
71 | // let diagnostics: Diagnostic[] = [];
72 | // let lines = textDocument.getText().split(/\r?\n/g);
73 | // let problems = 0;
74 | // for (var i = 0; i < lines.length && problems < maxNumberOfProblems; i++) {
75 | // let line = lines[i];
76 | // let index = line.indexOf('typescript');
77 | // if (index >= 0) {
78 | // problems++;
79 | // diagnostics.push({
80 | // severity: DiagnosticSeverity.Warning,
81 | // range: {
82 | // start: { line: i, character: index},
83 | // end: { line: i, character: index + 10 }
84 | // },
85 | // message: `${line.substr(index, 10)} should be spelled TypeScript`,
86 | // source: 'ex'
87 | // });
88 | // }
89 | // }
90 | // // Send the computed diagnostics to VSCode.
91 | // connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
92 | // }
93 |
94 | connection.onDidChangeWatchedFiles((change) => {
95 | // Monitored files have change in VSCode
96 | connection.console.log('We recevied an file change event');
97 | });
98 |
99 |
100 | // This handler provides the initial list of the completion items.
101 | // connection.onCompletion((textDocumentPosition: TextDocumentIdentifier): CompletionItem[] => {
102 | // // The pass parameter contains the position of the text document in
103 | // // which code complete got requested. For the example we ignore this
104 | // // info and always provide the same completion items.
105 | // return [
106 | // {
107 | // label: 'TypeScript',
108 | // kind: CompletionItemKind.Text,
109 | // data: 1
110 | // },
111 | // {
112 | // label: 'JavaScript',
113 | // kind: CompletionItemKind.Text,
114 | // data: 2
115 | // }
116 | // ]
117 | // });
118 |
119 | // This handler resolve additional information for the item selected in
120 | // the completion list.
121 | // connection.onCompletionResolve((item: CompletionItem): CompletionItem => {
122 | // if (item.data === 1) {
123 | // item.detail = 'TypeScript details',
124 | // item.documentation = 'TypeScript documentation'
125 | // } else if (item.data === 2) {
126 | // item.detail = 'JavaScript details',
127 | // item.documentation = 'JavaScript documentation'
128 | // }
129 | // return item;
130 | // });
131 |
132 | /*
133 | connection.onDidOpenTextDocument((params) => {
134 | // A text document got opened in VSCode.
135 | // params.uri uniquely identifies the document. For documents store on disk this is a file URI.
136 | // params.text the initial full content of the document.
137 | connection.console.log(`${params.uri} opened.`);
138 | });
139 |
140 | connection.onDidChangeTextDocument((params) => {
141 | // The content of a text document did change in VSCode.
142 | // params.uri uniquely identifies the document.
143 | // params.contentChanges describe the content changes to the document.
144 | connection.console.log(`${params.uri} changed: ${JSON.stringify(params.contentChanges)}`);
145 | });
146 |
147 | connection.onDidCloseTextDocument((params) => {
148 | // A text document got closed in VSCode.
149 | // params.uri uniquely identifies the document.
150 | connection.console.log(`${params.uri} closed.`);
151 | });
152 | */
153 |
154 | // Listen on the connection
155 | connection.listen();
--------------------------------------------------------------------------------
/server/typings/node/node.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Node.js v0.12.0
2 | // Project: http://nodejs.org/
3 | // Definitions by: Microsoft TypeScript , DefinitelyTyped
4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped
5 |
6 | /************************************************
7 | * *
8 | * Node.js v0.12.0 API *
9 | * *
10 | ************************************************/
11 |
12 | // compat for TypeScript 1.5.3
13 | // if you use with --target es3 or --target es5 and use below definitions,
14 | // use the lib.es6.d.ts that is bundled with TypeScript 1.5.3.
15 | interface MapConstructor {}
16 | interface WeakMapConstructor {}
17 | interface SetConstructor {}
18 | interface WeakSetConstructor {}
19 |
20 | /************************************************
21 | * *
22 | * GLOBAL *
23 | * *
24 | ************************************************/
25 | declare var process: NodeJS.Process;
26 | declare var global: NodeJS.Global;
27 |
28 | declare var __filename: string;
29 | declare var __dirname: string;
30 |
31 | declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
32 | declare function clearTimeout(timeoutId: NodeJS.Timer): void;
33 | declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
34 | declare function clearInterval(intervalId: NodeJS.Timer): void;
35 | declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
36 | declare function clearImmediate(immediateId: any): void;
37 |
38 | interface NodeRequireFunction {
39 | (id: string): any;
40 | }
41 |
42 | interface NodeRequire extends NodeRequireFunction {
43 | resolve(id:string): string;
44 | cache: any;
45 | extensions: any;
46 | main: any;
47 | }
48 |
49 | declare var require: NodeRequire;
50 |
51 | interface NodeModule {
52 | exports: any;
53 | require: NodeRequireFunction;
54 | id: string;
55 | filename: string;
56 | loaded: boolean;
57 | parent: any;
58 | children: any[];
59 | }
60 |
61 | declare var module: NodeModule;
62 |
63 | // Same as module.exports
64 | declare var exports: any;
65 | declare var SlowBuffer: {
66 | new (str: string, encoding?: string): Buffer;
67 | new (size: number): Buffer;
68 | new (size: Uint8Array): Buffer;
69 | new (array: any[]): Buffer;
70 | prototype: Buffer;
71 | isBuffer(obj: any): boolean;
72 | byteLength(string: string, encoding?: string): number;
73 | concat(list: Buffer[], totalLength?: number): Buffer;
74 | };
75 |
76 |
77 | // Buffer class
78 | interface Buffer extends NodeBuffer {}
79 |
80 | /**
81 | * Raw data is stored in instances of the Buffer class.
82 | * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
83 | * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
84 | */
85 | declare var Buffer: {
86 | /**
87 | * Allocates a new buffer containing the given {str}.
88 | *
89 | * @param str String to store in buffer.
90 | * @param encoding encoding to use, optional. Default is 'utf8'
91 | */
92 | new (str: string, encoding?: string): Buffer;
93 | /**
94 | * Allocates a new buffer of {size} octets.
95 | *
96 | * @param size count of octets to allocate.
97 | */
98 | new (size: number): Buffer;
99 | /**
100 | * Allocates a new buffer containing the given {array} of octets.
101 | *
102 | * @param array The octets to store.
103 | */
104 | new (array: Uint8Array): Buffer;
105 | /**
106 | * Allocates a new buffer containing the given {array} of octets.
107 | *
108 | * @param array The octets to store.
109 | */
110 | new (array: any[]): Buffer;
111 | prototype: Buffer;
112 | /**
113 | * Returns true if {obj} is a Buffer
114 | *
115 | * @param obj object to test.
116 | */
117 | isBuffer(obj: any): boolean;
118 | /**
119 | * Returns true if {encoding} is a valid encoding argument.
120 | * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
121 | *
122 | * @param encoding string to test.
123 | */
124 | isEncoding(encoding: string): boolean;
125 | /**
126 | * Gives the actual byte length of a string. encoding defaults to 'utf8'.
127 | * This is not the same as String.prototype.length since that returns the number of characters in a string.
128 | *
129 | * @param string string to test.
130 | * @param encoding encoding used to evaluate (defaults to 'utf8')
131 | */
132 | byteLength(string: string, encoding?: string): number;
133 | /**
134 | * Returns a buffer which is the result of concatenating all the buffers in the list together.
135 | *
136 | * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
137 | * If the list has exactly one item, then the first item of the list is returned.
138 | * If the list has more than one item, then a new Buffer is created.
139 | *
140 | * @param list An array of Buffer objects to concatenate
141 | * @param totalLength Total length of the buffers when concatenated.
142 | * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
143 | */
144 | concat(list: Buffer[], totalLength?: number): Buffer;
145 | /**
146 | * The same as buf1.compare(buf2).
147 | */
148 | compare(buf1: Buffer, buf2: Buffer): number;
149 | };
150 |
151 | /************************************************
152 | * *
153 | * GLOBAL INTERFACES *
154 | * *
155 | ************************************************/
156 | declare module NodeJS {
157 | export interface ErrnoException extends Error {
158 | errno?: number;
159 | code?: string;
160 | path?: string;
161 | syscall?: string;
162 | stack?: string;
163 | }
164 |
165 | export interface EventEmitter {
166 | addListener(event: string, listener: Function): EventEmitter;
167 | on(event: string, listener: Function): EventEmitter;
168 | once(event: string, listener: Function): EventEmitter;
169 | removeListener(event: string, listener: Function): EventEmitter;
170 | removeAllListeners(event?: string): EventEmitter;
171 | setMaxListeners(n: number): void;
172 | listeners(event: string): Function[];
173 | emit(event: string, ...args: any[]): boolean;
174 | }
175 |
176 | export interface ReadableStream extends EventEmitter {
177 | readable: boolean;
178 | read(size?: number): string|Buffer;
179 | setEncoding(encoding: string): void;
180 | pause(): void;
181 | resume(): void;
182 | pipe(destination: T, options?: { end?: boolean; }): T;
183 | unpipe(destination?: T): void;
184 | unshift(chunk: string): void;
185 | unshift(chunk: Buffer): void;
186 | wrap(oldStream: ReadableStream): ReadableStream;
187 | }
188 |
189 | export interface WritableStream extends EventEmitter {
190 | writable: boolean;
191 | write(buffer: Buffer, cb?: Function): boolean;
192 | write(str: string, cb?: Function): boolean;
193 | write(str: string, encoding?: string, cb?: Function): boolean;
194 | end(): void;
195 | end(buffer: Buffer, cb?: Function): void;
196 | end(str: string, cb?: Function): void;
197 | end(str: string, encoding?: string, cb?: Function): void;
198 | }
199 |
200 | export interface ReadWriteStream extends ReadableStream, WritableStream {}
201 |
202 | export interface Process extends EventEmitter {
203 | stdout: WritableStream;
204 | stderr: WritableStream;
205 | stdin: ReadableStream;
206 | argv: string[];
207 | execPath: string;
208 | abort(): void;
209 | chdir(directory: string): void;
210 | cwd(): string;
211 | env: any;
212 | exit(code?: number): void;
213 | getgid(): number;
214 | setgid(id: number): void;
215 | setgid(id: string): void;
216 | getuid(): number;
217 | setuid(id: number): void;
218 | setuid(id: string): void;
219 | version: string;
220 | versions: {
221 | http_parser: string;
222 | node: string;
223 | v8: string;
224 | ares: string;
225 | uv: string;
226 | zlib: string;
227 | openssl: string;
228 | };
229 | config: {
230 | target_defaults: {
231 | cflags: any[];
232 | default_configuration: string;
233 | defines: string[];
234 | include_dirs: string[];
235 | libraries: string[];
236 | };
237 | variables: {
238 | clang: number;
239 | host_arch: string;
240 | node_install_npm: boolean;
241 | node_install_waf: boolean;
242 | node_prefix: string;
243 | node_shared_openssl: boolean;
244 | node_shared_v8: boolean;
245 | node_shared_zlib: boolean;
246 | node_use_dtrace: boolean;
247 | node_use_etw: boolean;
248 | node_use_openssl: boolean;
249 | target_arch: string;
250 | v8_no_strict_aliasing: number;
251 | v8_use_snapshot: boolean;
252 | visibility: string;
253 | };
254 | };
255 | kill(pid: number, signal?: string): void;
256 | pid: number;
257 | title: string;
258 | arch: string;
259 | platform: string;
260 | memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; };
261 | nextTick(callback: Function): void;
262 | umask(mask?: number): number;
263 | uptime(): number;
264 | hrtime(time?:number[]): number[];
265 |
266 | // Worker
267 | send?(message: any, sendHandle?: any): void;
268 | }
269 |
270 | export interface Global {
271 | Array: typeof Array;
272 | ArrayBuffer: typeof ArrayBuffer;
273 | Boolean: typeof Boolean;
274 | Buffer: typeof Buffer;
275 | DataView: typeof DataView;
276 | Date: typeof Date;
277 | Error: typeof Error;
278 | EvalError: typeof EvalError;
279 | Float32Array: typeof Float32Array;
280 | Float64Array: typeof Float64Array;
281 | Function: typeof Function;
282 | GLOBAL: Global;
283 | Infinity: typeof Infinity;
284 | Int16Array: typeof Int16Array;
285 | Int32Array: typeof Int32Array;
286 | Int8Array: typeof Int8Array;
287 | Intl: typeof Intl;
288 | JSON: typeof JSON;
289 | Map: MapConstructor;
290 | Math: typeof Math;
291 | NaN: typeof NaN;
292 | Number: typeof Number;
293 | Object: typeof Object;
294 | Promise: Function;
295 | RangeError: typeof RangeError;
296 | ReferenceError: typeof ReferenceError;
297 | RegExp: typeof RegExp;
298 | Set: SetConstructor;
299 | String: typeof String;
300 | Symbol: Function;
301 | SyntaxError: typeof SyntaxError;
302 | TypeError: typeof TypeError;
303 | URIError: typeof URIError;
304 | Uint16Array: typeof Uint16Array;
305 | Uint32Array: typeof Uint32Array;
306 | Uint8Array: typeof Uint8Array;
307 | Uint8ClampedArray: Function;
308 | WeakMap: WeakMapConstructor;
309 | WeakSet: WeakSetConstructor;
310 | clearImmediate: (immediateId: any) => void;
311 | clearInterval: (intervalId: NodeJS.Timer) => void;
312 | clearTimeout: (timeoutId: NodeJS.Timer) => void;
313 | console: typeof console;
314 | decodeURI: typeof decodeURI;
315 | decodeURIComponent: typeof decodeURIComponent;
316 | encodeURI: typeof encodeURI;
317 | encodeURIComponent: typeof encodeURIComponent;
318 | escape: (str: string) => string;
319 | eval: typeof eval;
320 | global: Global;
321 | isFinite: typeof isFinite;
322 | isNaN: typeof isNaN;
323 | parseFloat: typeof parseFloat;
324 | parseInt: typeof parseInt;
325 | process: Process;
326 | root: Global;
327 | setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any;
328 | setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer;
329 | setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer;
330 | undefined: typeof undefined;
331 | unescape: (str: string) => string;
332 | gc: () => void;
333 | }
334 |
335 | export interface Timer {
336 | ref() : void;
337 | unref() : void;
338 | }
339 | }
340 |
341 | /**
342 | * @deprecated
343 | */
344 | interface NodeBuffer {
345 | [index: number]: number;
346 | write(string: string, offset?: number, length?: number, encoding?: string): number;
347 | toString(encoding?: string, start?: number, end?: number): string;
348 | toJSON(): any;
349 | length: number;
350 | equals(otherBuffer: Buffer): boolean;
351 | compare(otherBuffer: Buffer): number;
352 | copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
353 | slice(start?: number, end?: number): Buffer;
354 | writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
355 | writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
356 | writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
357 | writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
358 | readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
359 | readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
360 | readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
361 | readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
362 | readUInt8(offset: number, noAsset?: boolean): number;
363 | readUInt16LE(offset: number, noAssert?: boolean): number;
364 | readUInt16BE(offset: number, noAssert?: boolean): number;
365 | readUInt32LE(offset: number, noAssert?: boolean): number;
366 | readUInt32BE(offset: number, noAssert?: boolean): number;
367 | readInt8(offset: number, noAssert?: boolean): number;
368 | readInt16LE(offset: number, noAssert?: boolean): number;
369 | readInt16BE(offset: number, noAssert?: boolean): number;
370 | readInt32LE(offset: number, noAssert?: boolean): number;
371 | readInt32BE(offset: number, noAssert?: boolean): number;
372 | readFloatLE(offset: number, noAssert?: boolean): number;
373 | readFloatBE(offset: number, noAssert?: boolean): number;
374 | readDoubleLE(offset: number, noAssert?: boolean): number;
375 | readDoubleBE(offset: number, noAssert?: boolean): number;
376 | writeUInt8(value: number, offset: number, noAssert?: boolean): void;
377 | writeUInt16LE(value: number, offset: number, noAssert?: boolean): void;
378 | writeUInt16BE(value: number, offset: number, noAssert?: boolean): void;
379 | writeUInt32LE(value: number, offset: number, noAssert?: boolean): void;
380 | writeUInt32BE(value: number, offset: number, noAssert?: boolean): void;
381 | writeInt8(value: number, offset: number, noAssert?: boolean): void;
382 | writeInt16LE(value: number, offset: number, noAssert?: boolean): void;
383 | writeInt16BE(value: number, offset: number, noAssert?: boolean): void;
384 | writeInt32LE(value: number, offset: number, noAssert?: boolean): void;
385 | writeInt32BE(value: number, offset: number, noAssert?: boolean): void;
386 | writeFloatLE(value: number, offset: number, noAssert?: boolean): void;
387 | writeFloatBE(value: number, offset: number, noAssert?: boolean): void;
388 | writeDoubleLE(value: number, offset: number, noAssert?: boolean): void;
389 | writeDoubleBE(value: number, offset: number, noAssert?: boolean): void;
390 | fill(value: any, offset?: number, end?: number): void;
391 | }
392 |
393 | /************************************************
394 | * *
395 | * MODULES *
396 | * *
397 | ************************************************/
398 | declare module "buffer" {
399 | export var INSPECT_MAX_BYTES: number;
400 | }
401 |
402 | declare module "querystring" {
403 | export function stringify(obj: any, sep?: string, eq?: string): string;
404 | export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any;
405 | export function escape(str: string): string;
406 | export function unescape(str: string): string;
407 | }
408 |
409 | declare module "events" {
410 | export class EventEmitter implements NodeJS.EventEmitter {
411 | static listenerCount(emitter: EventEmitter, event: string): number;
412 |
413 | addListener(event: string, listener: Function): EventEmitter;
414 | on(event: string, listener: Function): EventEmitter;
415 | once(event: string, listener: Function): EventEmitter;
416 | removeListener(event: string, listener: Function): EventEmitter;
417 | removeAllListeners(event?: string): EventEmitter;
418 | setMaxListeners(n: number): void;
419 | listeners(event: string): Function[];
420 | emit(event: string, ...args: any[]): boolean;
421 | }
422 | }
423 |
424 | declare module "http" {
425 | import * as events from "events";
426 | import * as net from "net";
427 | import * as stream from "stream";
428 |
429 | export interface Server extends events.EventEmitter {
430 | listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
431 | listen(port: number, hostname?: string, callback?: Function): Server;
432 | listen(path: string, callback?: Function): Server;
433 | listen(handle: any, listeningListener?: Function): Server;
434 | close(cb?: any): Server;
435 | address(): { port: number; family: string; address: string; };
436 | maxHeadersCount: number;
437 | }
438 | /**
439 | * @deprecated Use IncomingMessage
440 | */
441 | export interface ServerRequest extends IncomingMessage {
442 | connection: net.Socket;
443 | }
444 | export interface ServerResponse extends events.EventEmitter, stream.Writable {
445 | // Extended base methods
446 | write(buffer: Buffer): boolean;
447 | write(buffer: Buffer, cb?: Function): boolean;
448 | write(str: string, cb?: Function): boolean;
449 | write(str: string, encoding?: string, cb?: Function): boolean;
450 | write(str: string, encoding?: string, fd?: string): boolean;
451 |
452 | writeContinue(): void;
453 | writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void;
454 | writeHead(statusCode: number, headers?: any): void;
455 | statusCode: number;
456 | statusMessage: string;
457 | setHeader(name: string, value: string): void;
458 | sendDate: boolean;
459 | getHeader(name: string): string;
460 | removeHeader(name: string): void;
461 | write(chunk: any, encoding?: string): any;
462 | addTrailers(headers: any): void;
463 |
464 | // Extended base methods
465 | end(): void;
466 | end(buffer: Buffer, cb?: Function): void;
467 | end(str: string, cb?: Function): void;
468 | end(str: string, encoding?: string, cb?: Function): void;
469 | end(data?: any, encoding?: string): void;
470 | }
471 | export interface ClientRequest extends events.EventEmitter, stream.Writable {
472 | // Extended base methods
473 | write(buffer: Buffer): boolean;
474 | write(buffer: Buffer, cb?: Function): boolean;
475 | write(str: string, cb?: Function): boolean;
476 | write(str: string, encoding?: string, cb?: Function): boolean;
477 | write(str: string, encoding?: string, fd?: string): boolean;
478 |
479 | write(chunk: any, encoding?: string): void;
480 | abort(): void;
481 | setTimeout(timeout: number, callback?: Function): void;
482 | setNoDelay(noDelay?: boolean): void;
483 | setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
484 |
485 | // Extended base methods
486 | end(): void;
487 | end(buffer: Buffer, cb?: Function): void;
488 | end(str: string, cb?: Function): void;
489 | end(str: string, encoding?: string, cb?: Function): void;
490 | end(data?: any, encoding?: string): void;
491 | }
492 | export interface IncomingMessage extends events.EventEmitter, stream.Readable {
493 | httpVersion: string;
494 | headers: any;
495 | rawHeaders: string[];
496 | trailers: any;
497 | rawTrailers: any;
498 | setTimeout(msecs: number, callback: Function): NodeJS.Timer;
499 | /**
500 | * Only valid for request obtained from http.Server.
501 | */
502 | method?: string;
503 | /**
504 | * Only valid for request obtained from http.Server.
505 | */
506 | url?: string;
507 | /**
508 | * Only valid for response obtained from http.ClientRequest.
509 | */
510 | statusCode?: number;
511 | /**
512 | * Only valid for response obtained from http.ClientRequest.
513 | */
514 | statusMessage?: string;
515 | socket: net.Socket;
516 | }
517 | /**
518 | * @deprecated Use IncomingMessage
519 | */
520 | export interface ClientResponse extends IncomingMessage { }
521 |
522 | export interface AgentOptions {
523 | /**
524 | * Keep sockets around in a pool to be used by other requests in the future. Default = false
525 | */
526 | keepAlive?: boolean;
527 | /**
528 | * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
529 | * Only relevant if keepAlive is set to true.
530 | */
531 | keepAliveMsecs?: number;
532 | /**
533 | * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
534 | */
535 | maxSockets?: number;
536 | /**
537 | * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
538 | */
539 | maxFreeSockets?: number;
540 | }
541 |
542 | export class Agent {
543 | maxSockets: number;
544 | sockets: any;
545 | requests: any;
546 |
547 | constructor(opts?: AgentOptions);
548 |
549 | /**
550 | * Destroy any sockets that are currently in use by the agent.
551 | * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled,
552 | * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise,
553 | * sockets may hang open for quite a long time before the server terminates them.
554 | */
555 | destroy(): void;
556 | }
557 |
558 | export var METHODS: string[];
559 |
560 | export var STATUS_CODES: {
561 | [errorCode: number]: string;
562 | [errorCode: string]: string;
563 | };
564 | export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
565 | export function createClient(port?: number, host?: string): any;
566 | export function request(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
567 | export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
568 | export var globalAgent: Agent;
569 | }
570 |
571 | declare module "cluster" {
572 | import * as child from "child_process";
573 | import * as events from "events";
574 |
575 | export interface ClusterSettings {
576 | exec?: string;
577 | args?: string[];
578 | silent?: boolean;
579 | }
580 |
581 | export class Worker extends events.EventEmitter {
582 | id: string;
583 | process: child.ChildProcess;
584 | suicide: boolean;
585 | send(message: any, sendHandle?: any): void;
586 | kill(signal?: string): void;
587 | destroy(signal?: string): void;
588 | disconnect(): void;
589 | }
590 |
591 | export var settings: ClusterSettings;
592 | export var isMaster: boolean;
593 | export var isWorker: boolean;
594 | export function setupMaster(settings?: ClusterSettings): void;
595 | export function fork(env?: any): Worker;
596 | export function disconnect(callback?: Function): void;
597 | export var worker: Worker;
598 | export var workers: Worker[];
599 |
600 | // Event emitter
601 | export function addListener(event: string, listener: Function): void;
602 | export function on(event: string, listener: Function): any;
603 | export function once(event: string, listener: Function): void;
604 | export function removeListener(event: string, listener: Function): void;
605 | export function removeAllListeners(event?: string): void;
606 | export function setMaxListeners(n: number): void;
607 | export function listeners(event: string): Function[];
608 | export function emit(event: string, ...args: any[]): boolean;
609 | }
610 |
611 | declare module "zlib" {
612 | import * as stream from "stream";
613 | export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; }
614 |
615 | export interface Gzip extends stream.Transform { }
616 | export interface Gunzip extends stream.Transform { }
617 | export interface Deflate extends stream.Transform { }
618 | export interface Inflate extends stream.Transform { }
619 | export interface DeflateRaw extends stream.Transform { }
620 | export interface InflateRaw extends stream.Transform { }
621 | export interface Unzip extends stream.Transform { }
622 |
623 | export function createGzip(options?: ZlibOptions): Gzip;
624 | export function createGunzip(options?: ZlibOptions): Gunzip;
625 | export function createDeflate(options?: ZlibOptions): Deflate;
626 | export function createInflate(options?: ZlibOptions): Inflate;
627 | export function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
628 | export function createInflateRaw(options?: ZlibOptions): InflateRaw;
629 | export function createUnzip(options?: ZlibOptions): Unzip;
630 |
631 | export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
632 | export function deflateSync(buf: Buffer, options?: ZlibOptions): any;
633 | export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
634 | export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any;
635 | export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
636 | export function gzipSync(buf: Buffer, options?: ZlibOptions): any;
637 | export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
638 | export function gunzipSync(buf: Buffer, options?: ZlibOptions): any;
639 | export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
640 | export function inflateSync(buf: Buffer, options?: ZlibOptions): any;
641 | export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
642 | export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any;
643 | export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
644 | export function unzipSync(buf: Buffer, options?: ZlibOptions): any;
645 |
646 | // Constants
647 | export var Z_NO_FLUSH: number;
648 | export var Z_PARTIAL_FLUSH: number;
649 | export var Z_SYNC_FLUSH: number;
650 | export var Z_FULL_FLUSH: number;
651 | export var Z_FINISH: number;
652 | export var Z_BLOCK: number;
653 | export var Z_TREES: number;
654 | export var Z_OK: number;
655 | export var Z_STREAM_END: number;
656 | export var Z_NEED_DICT: number;
657 | export var Z_ERRNO: number;
658 | export var Z_STREAM_ERROR: number;
659 | export var Z_DATA_ERROR: number;
660 | export var Z_MEM_ERROR: number;
661 | export var Z_BUF_ERROR: number;
662 | export var Z_VERSION_ERROR: number;
663 | export var Z_NO_COMPRESSION: number;
664 | export var Z_BEST_SPEED: number;
665 | export var Z_BEST_COMPRESSION: number;
666 | export var Z_DEFAULT_COMPRESSION: number;
667 | export var Z_FILTERED: number;
668 | export var Z_HUFFMAN_ONLY: number;
669 | export var Z_RLE: number;
670 | export var Z_FIXED: number;
671 | export var Z_DEFAULT_STRATEGY: number;
672 | export var Z_BINARY: number;
673 | export var Z_TEXT: number;
674 | export var Z_ASCII: number;
675 | export var Z_UNKNOWN: number;
676 | export var Z_DEFLATED: number;
677 | export var Z_NULL: number;
678 | }
679 |
680 | declare module "os" {
681 | export function tmpdir(): string;
682 | export function hostname(): string;
683 | export function type(): string;
684 | export function platform(): string;
685 | export function arch(): string;
686 | export function release(): string;
687 | export function uptime(): number;
688 | export function loadavg(): number[];
689 | export function totalmem(): number;
690 | export function freemem(): number;
691 | export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[];
692 | export function networkInterfaces(): any;
693 | export var EOL: string;
694 | }
695 |
696 | declare module "https" {
697 | import * as tls from "tls";
698 | import * as events from "events";
699 | import * as http from "http";
700 |
701 | export interface ServerOptions {
702 | pfx?: any;
703 | key?: any;
704 | passphrase?: string;
705 | cert?: any;
706 | ca?: any;
707 | crl?: any;
708 | ciphers?: string;
709 | honorCipherOrder?: boolean;
710 | requestCert?: boolean;
711 | rejectUnauthorized?: boolean;
712 | NPNProtocols?: any;
713 | SNICallback?: (servername: string) => any;
714 | }
715 |
716 | export interface RequestOptions {
717 | host?: string;
718 | hostname?: string;
719 | port?: number;
720 | path?: string;
721 | method?: string;
722 | headers?: any;
723 | auth?: string;
724 | agent?: any;
725 | pfx?: any;
726 | key?: any;
727 | passphrase?: string;
728 | cert?: any;
729 | ca?: any;
730 | ciphers?: string;
731 | rejectUnauthorized?: boolean;
732 | }
733 |
734 | export interface Agent {
735 | maxSockets: number;
736 | sockets: any;
737 | requests: any;
738 | }
739 | export var Agent: {
740 | new (options?: RequestOptions): Agent;
741 | };
742 | export interface Server extends tls.Server { }
743 | export function createServer(options: ServerOptions, requestListener?: Function): Server;
744 | export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
745 | export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
746 | export var globalAgent: Agent;
747 | }
748 |
749 | declare module "punycode" {
750 | export function decode(string: string): string;
751 | export function encode(string: string): string;
752 | export function toUnicode(domain: string): string;
753 | export function toASCII(domain: string): string;
754 | export var ucs2: ucs2;
755 | interface ucs2 {
756 | decode(string: string): string;
757 | encode(codePoints: number[]): string;
758 | }
759 | export var version: any;
760 | }
761 |
762 | declare module "repl" {
763 | import * as stream from "stream";
764 | import * as events from "events";
765 |
766 | export interface ReplOptions {
767 | prompt?: string;
768 | input?: NodeJS.ReadableStream;
769 | output?: NodeJS.WritableStream;
770 | terminal?: boolean;
771 | eval?: Function;
772 | useColors?: boolean;
773 | useGlobal?: boolean;
774 | ignoreUndefined?: boolean;
775 | writer?: Function;
776 | }
777 | export function start(options: ReplOptions): events.EventEmitter;
778 | }
779 |
780 | declare module "readline" {
781 | import * as events from "events";
782 | import * as stream from "stream";
783 |
784 | export interface ReadLine extends events.EventEmitter {
785 | setPrompt(prompt: string): void;
786 | prompt(preserveCursor?: boolean): void;
787 | question(query: string, callback: Function): void;
788 | pause(): void;
789 | resume(): void;
790 | close(): void;
791 | write(data: any, key?: any): void;
792 | }
793 | export interface ReadLineOptions {
794 | input: NodeJS.ReadableStream;
795 | output: NodeJS.WritableStream;
796 | completer?: Function;
797 | terminal?: boolean;
798 | }
799 | export function createInterface(options: ReadLineOptions): ReadLine;
800 | }
801 |
802 | declare module "vm" {
803 | export interface Context { }
804 | export interface Script {
805 | runInThisContext(): void;
806 | runInNewContext(sandbox?: Context): void;
807 | }
808 | export function runInThisContext(code: string, filename?: string): void;
809 | export function runInNewContext(code: string, sandbox?: Context, filename?: string): void;
810 | export function runInContext(code: string, context: Context, filename?: string): void;
811 | export function createContext(initSandbox?: Context): Context;
812 | export function createScript(code: string, filename?: string): Script;
813 | }
814 |
815 | declare module "child_process" {
816 | import * as events from "events";
817 | import * as stream from "stream";
818 |
819 | export interface ChildProcess extends events.EventEmitter {
820 | stdin: stream.Writable;
821 | stdout: stream.Readable;
822 | stderr: stream.Readable;
823 | pid: number;
824 | kill(signal?: string): void;
825 | send(message: any, sendHandle?: any): void;
826 | disconnect(): void;
827 | unref(): void;
828 | }
829 |
830 | export function spawn(command: string, args?: string[], options?: {
831 | cwd?: string;
832 | stdio?: any;
833 | custom?: any;
834 | env?: any;
835 | detached?: boolean;
836 | }): ChildProcess;
837 | export function exec(command: string, options: {
838 | cwd?: string;
839 | stdio?: any;
840 | customFds?: any;
841 | env?: any;
842 | encoding?: string;
843 | timeout?: number;
844 | maxBuffer?: number;
845 | killSignal?: string;
846 | }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
847 | export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
848 | export function execFile(file: string,
849 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
850 | export function execFile(file: string, args?: string[],
851 | callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
852 | export function execFile(file: string, args?: string[], options?: {
853 | cwd?: string;
854 | stdio?: any;
855 | customFds?: any;
856 | env?: any;
857 | encoding?: string;
858 | timeout?: number;
859 | maxBuffer?: string;
860 | killSignal?: string;
861 | }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess;
862 | export function fork(modulePath: string, args?: string[], options?: {
863 | cwd?: string;
864 | env?: any;
865 | encoding?: string;
866 | }): ChildProcess;
867 | export function execSync(command: string, options?: {
868 | cwd?: string;
869 | input?: string|Buffer;
870 | stdio?: any;
871 | env?: any;
872 | uid?: number;
873 | gid?: number;
874 | timeout?: number;
875 | maxBuffer?: number;
876 | killSignal?: string;
877 | encoding?: string;
878 | }): ChildProcess;
879 | export function execFileSync(command: string, args?: string[], options?: {
880 | cwd?: string;
881 | input?: string|Buffer;
882 | stdio?: any;
883 | env?: any;
884 | uid?: number;
885 | gid?: number;
886 | timeout?: number;
887 | maxBuffer?: number;
888 | killSignal?: string;
889 | encoding?: string;
890 | }): ChildProcess;
891 | }
892 |
893 | declare module "url" {
894 | export interface Url {
895 | href: string;
896 | protocol: string;
897 | auth: string;
898 | hostname: string;
899 | port: string;
900 | host: string;
901 | pathname: string;
902 | search: string;
903 | query: any; // string | Object
904 | slashes: boolean;
905 | hash?: string;
906 | path?: string;
907 | }
908 |
909 | export interface UrlOptions {
910 | protocol?: string;
911 | auth?: string;
912 | hostname?: string;
913 | port?: string;
914 | host?: string;
915 | pathname?: string;
916 | search?: string;
917 | query?: any;
918 | hash?: string;
919 | path?: string;
920 | }
921 |
922 | export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
923 | export function format(url: UrlOptions): string;
924 | export function resolve(from: string, to: string): string;
925 | }
926 |
927 | declare module "dns" {
928 | export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string;
929 | export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string;
930 | export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[];
931 | export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
932 | export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
933 | export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
934 | export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
935 | export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
936 | export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
937 | export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
938 | export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
939 | export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[];
940 | }
941 |
942 | declare module "net" {
943 | import * as stream from "stream";
944 |
945 | export interface Socket extends stream.Duplex {
946 | // Extended base methods
947 | write(buffer: Buffer): boolean;
948 | write(buffer: Buffer, cb?: Function): boolean;
949 | write(str: string, cb?: Function): boolean;
950 | write(str: string, encoding?: string, cb?: Function): boolean;
951 | write(str: string, encoding?: string, fd?: string): boolean;
952 |
953 | connect(port: number, host?: string, connectionListener?: Function): void;
954 | connect(path: string, connectionListener?: Function): void;
955 | bufferSize: number;
956 | setEncoding(encoding?: string): void;
957 | write(data: any, encoding?: string, callback?: Function): void;
958 | destroy(): void;
959 | pause(): void;
960 | resume(): void;
961 | setTimeout(timeout: number, callback?: Function): void;
962 | setNoDelay(noDelay?: boolean): void;
963 | setKeepAlive(enable?: boolean, initialDelay?: number): void;
964 | address(): { port: number; family: string; address: string; };
965 | unref(): void;
966 | ref(): void;
967 |
968 | remoteAddress: string;
969 | remoteFamily: string;
970 | remotePort: number;
971 | localAddress: string;
972 | localPort: number;
973 | bytesRead: number;
974 | bytesWritten: number;
975 |
976 | // Extended base methods
977 | end(): void;
978 | end(buffer: Buffer, cb?: Function): void;
979 | end(str: string, cb?: Function): void;
980 | end(str: string, encoding?: string, cb?: Function): void;
981 | end(data?: any, encoding?: string): void;
982 | }
983 |
984 | export var Socket: {
985 | new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): Socket;
986 | };
987 |
988 | export interface Server extends Socket {
989 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server;
990 | listen(path: string, listeningListener?: Function): Server;
991 | listen(handle: any, listeningListener?: Function): Server;
992 | close(callback?: Function): Server;
993 | address(): { port: number; family: string; address: string; };
994 | maxConnections: number;
995 | connections: number;
996 | }
997 | export function createServer(connectionListener?: (socket: Socket) =>void ): Server;
998 | export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server;
999 | export function connect(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
1000 | export function connect(port: number, host?: string, connectionListener?: Function): Socket;
1001 | export function connect(path: string, connectionListener?: Function): Socket;
1002 | export function createConnection(options: { allowHalfOpen?: boolean; }, connectionListener?: Function): Socket;
1003 | export function createConnection(port: number, host?: string, connectionListener?: Function): Socket;
1004 | export function createConnection(path: string, connectionListener?: Function): Socket;
1005 | export function isIP(input: string): number;
1006 | export function isIPv4(input: string): boolean;
1007 | export function isIPv6(input: string): boolean;
1008 | }
1009 |
1010 | declare module "dgram" {
1011 | import * as events from "events";
1012 |
1013 | interface RemoteInfo {
1014 | address: string;
1015 | port: number;
1016 | size: number;
1017 | }
1018 |
1019 | interface AddressInfo {
1020 | address: string;
1021 | family: string;
1022 | port: number;
1023 | }
1024 |
1025 | export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
1026 |
1027 | interface Socket extends events.EventEmitter {
1028 | send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
1029 | bind(port: number, address?: string, callback?: () => void): void;
1030 | close(): void;
1031 | address(): AddressInfo;
1032 | setBroadcast(flag: boolean): void;
1033 | setMulticastTTL(ttl: number): void;
1034 | setMulticastLoopback(flag: boolean): void;
1035 | addMembership(multicastAddress: string, multicastInterface?: string): void;
1036 | dropMembership(multicastAddress: string, multicastInterface?: string): void;
1037 | }
1038 | }
1039 |
1040 | declare module "fs" {
1041 | import * as stream from "stream";
1042 | import * as events from "events";
1043 |
1044 | interface Stats {
1045 | isFile(): boolean;
1046 | isDirectory(): boolean;
1047 | isBlockDevice(): boolean;
1048 | isCharacterDevice(): boolean;
1049 | isSymbolicLink(): boolean;
1050 | isFIFO(): boolean;
1051 | isSocket(): boolean;
1052 | dev: number;
1053 | ino: number;
1054 | mode: number;
1055 | nlink: number;
1056 | uid: number;
1057 | gid: number;
1058 | rdev: number;
1059 | size: number;
1060 | blksize: number;
1061 | blocks: number;
1062 | atime: Date;
1063 | mtime: Date;
1064 | ctime: Date;
1065 | }
1066 |
1067 | interface FSWatcher extends events.EventEmitter {
1068 | close(): void;
1069 | }
1070 |
1071 | export interface ReadStream extends stream.Readable {
1072 | close(): void;
1073 | }
1074 | export interface WriteStream extends stream.Writable {
1075 | close(): void;
1076 | bytesWritten: number;
1077 | }
1078 |
1079 | /**
1080 | * Asynchronous rename.
1081 | * @param oldPath
1082 | * @param newPath
1083 | * @param callback No arguments other than a possible exception are given to the completion callback.
1084 | */
1085 | export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1086 | /**
1087 | * Synchronous rename
1088 | * @param oldPath
1089 | * @param newPath
1090 | */
1091 | export function renameSync(oldPath: string, newPath: string): void;
1092 | export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1093 | export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1094 | export function truncateSync(path: string, len?: number): void;
1095 | export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1096 | export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1097 | export function ftruncateSync(fd: number, len?: number): void;
1098 | export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1099 | export function chownSync(path: string, uid: number, gid: number): void;
1100 | export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1101 | export function fchownSync(fd: number, uid: number, gid: number): void;
1102 | export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1103 | export function lchownSync(path: string, uid: number, gid: number): void;
1104 | export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1105 | export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1106 | export function chmodSync(path: string, mode: number): void;
1107 | export function chmodSync(path: string, mode: string): void;
1108 | export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1109 | export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1110 | export function fchmodSync(fd: number, mode: number): void;
1111 | export function fchmodSync(fd: number, mode: string): void;
1112 | export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1113 | export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1114 | export function lchmodSync(path: string, mode: number): void;
1115 | export function lchmodSync(path: string, mode: string): void;
1116 | export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
1117 | export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
1118 | export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
1119 | export function statSync(path: string): Stats;
1120 | export function lstatSync(path: string): Stats;
1121 | export function fstatSync(fd: number): Stats;
1122 | export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1123 | export function linkSync(srcpath: string, dstpath: string): void;
1124 | export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1125 | export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
1126 | export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void;
1127 | export function readlinkSync(path: string): string;
1128 | export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
1129 | export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void;
1130 | export function realpathSync(path: string, cache?: { [path: string]: string }): string;
1131 | /*
1132 | * Asynchronous unlink - deletes the file specified in {path}
1133 | *
1134 | * @param path
1135 | * @param callback No arguments other than a possible exception are given to the completion callback.
1136 | */
1137 | export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1138 | /*
1139 | * Synchronous unlink - deletes the file specified in {path}
1140 | *
1141 | * @param path
1142 | */
1143 | export function unlinkSync(path: string): void;
1144 | /*
1145 | * Asynchronous rmdir - removes the directory specified in {path}
1146 | *
1147 | * @param path
1148 | * @param callback No arguments other than a possible exception are given to the completion callback.
1149 | */
1150 | export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1151 | /*
1152 | * Synchronous rmdir - removes the directory specified in {path}
1153 | *
1154 | * @param path
1155 | */
1156 | export function rmdirSync(path: string): void;
1157 | /*
1158 | * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
1159 | *
1160 | * @param path
1161 | * @param callback No arguments other than a possible exception are given to the completion callback.
1162 | */
1163 | export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1164 | /*
1165 | * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
1166 | *
1167 | * @param path
1168 | * @param mode
1169 | * @param callback No arguments other than a possible exception are given to the completion callback.
1170 | */
1171 | export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1172 | /*
1173 | * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
1174 | *
1175 | * @param path
1176 | * @param mode
1177 | * @param callback No arguments other than a possible exception are given to the completion callback.
1178 | */
1179 | export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void;
1180 | /*
1181 | * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
1182 | *
1183 | * @param path
1184 | * @param mode
1185 | * @param callback No arguments other than a possible exception are given to the completion callback.
1186 | */
1187 | export function mkdirSync(path: string, mode?: number): void;
1188 | /*
1189 | * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
1190 | *
1191 | * @param path
1192 | * @param mode
1193 | * @param callback No arguments other than a possible exception are given to the completion callback.
1194 | */
1195 | export function mkdirSync(path: string, mode?: string): void;
1196 | export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void;
1197 | export function readdirSync(path: string): string[];
1198 | export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1199 | export function closeSync(fd: number): void;
1200 | export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
1201 | export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
1202 | export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void;
1203 | export function openSync(path: string, flags: string, mode?: number): number;
1204 | export function openSync(path: string, flags: string, mode?: string): number;
1205 | export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1206 | export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
1207 | export function utimesSync(path: string, atime: number, mtime: number): void;
1208 | export function utimesSync(path: string, atime: Date, mtime: Date): void;
1209 | export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1210 | export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void;
1211 | export function futimesSync(fd: number, atime: number, mtime: number): void;
1212 | export function futimesSync(fd: number, atime: Date, mtime: Date): void;
1213 | export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void;
1214 | export function fsyncSync(fd: number): void;
1215 | export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
1216 | export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
1217 | export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
1218 | export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
1219 | export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
1220 | /*
1221 | * Asynchronous readFile - Asynchronously reads the entire contents of a file.
1222 | *
1223 | * @param fileName
1224 | * @param encoding
1225 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
1226 | */
1227 | export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
1228 | /*
1229 | * Asynchronous readFile - Asynchronously reads the entire contents of a file.
1230 | *
1231 | * @param fileName
1232 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
1233 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
1234 | */
1235 | export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
1236 | /*
1237 | * Asynchronous readFile - Asynchronously reads the entire contents of a file.
1238 | *
1239 | * @param fileName
1240 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer.
1241 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
1242 | */
1243 | export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
1244 | /*
1245 | * Asynchronous readFile - Asynchronously reads the entire contents of a file.
1246 | *
1247 | * @param fileName
1248 | * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file.
1249 | */
1250 | export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
1251 | /*
1252 | * Synchronous readFile - Synchronously reads the entire contents of a file.
1253 | *
1254 | * @param fileName
1255 | * @param encoding
1256 | */
1257 | export function readFileSync(filename: string, encoding: string): string;
1258 | /*
1259 | * Synchronous readFile - Synchronously reads the entire contents of a file.
1260 | *
1261 | * @param fileName
1262 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
1263 | */
1264 | export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string;
1265 | /*
1266 | * Synchronous readFile - Synchronously reads the entire contents of a file.
1267 | *
1268 | * @param fileName
1269 | * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer.
1270 | */
1271 | export function readFileSync(filename: string, options?: { flag?: string; }): Buffer;
1272 | export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
1273 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
1274 | export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
1275 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
1276 | export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
1277 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
1278 | export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
1279 | export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void;
1280 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
1281 | export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
1282 | export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void;
1283 | export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void;
1284 | export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void;
1285 | export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher;
1286 | export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
1287 | export function exists(path: string, callback?: (exists: boolean) => void): void;
1288 | export function existsSync(path: string): boolean;
1289 | /** Constant for fs.access(). File is visible to the calling process. */
1290 | export var F_OK: number;
1291 | /** Constant for fs.access(). File can be read by the calling process. */
1292 | export var R_OK: number;
1293 | /** Constant for fs.access(). File can be written by the calling process. */
1294 | export var W_OK: number;
1295 | /** Constant for fs.access(). File can be executed by the calling process. */
1296 | export var X_OK: number;
1297 | /** Tests a user's permissions for the file specified by path. */
1298 | export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void;
1299 | export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
1300 | /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */
1301 | export function accessSync(path: string, mode ?: number): void;
1302 | export function createReadStream(path: string, options?: {
1303 | flags?: string;
1304 | encoding?: string;
1305 | fd?: string;
1306 | mode?: number;
1307 | bufferSize?: number;
1308 | }): ReadStream;
1309 | export function createReadStream(path: string, options?: {
1310 | flags?: string;
1311 | encoding?: string;
1312 | fd?: string;
1313 | mode?: string;
1314 | bufferSize?: number;
1315 | }): ReadStream;
1316 | export function createWriteStream(path: string, options?: {
1317 | flags?: string;
1318 | encoding?: string;
1319 | string?: string;
1320 | }): WriteStream;
1321 | }
1322 |
1323 | declare module "path" {
1324 |
1325 | /**
1326 | * A parsed path object generated by path.parse() or consumed by path.format().
1327 | */
1328 | export interface ParsedPath {
1329 | /**
1330 | * The root of the path such as '/' or 'c:\'
1331 | */
1332 | root: string;
1333 | /**
1334 | * The full directory path such as '/home/user/dir' or 'c:\path\dir'
1335 | */
1336 | dir: string;
1337 | /**
1338 | * The file name including extension (if any) such as 'index.html'
1339 | */
1340 | base: string;
1341 | /**
1342 | * The file extension (if any) such as '.html'
1343 | */
1344 | ext: string;
1345 | /**
1346 | * The file name without extension (if any) such as 'index'
1347 | */
1348 | name: string;
1349 | }
1350 |
1351 | /**
1352 | * Normalize a string path, reducing '..' and '.' parts.
1353 | * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
1354 | *
1355 | * @param p string path to normalize.
1356 | */
1357 | export function normalize(p: string): string;
1358 | /**
1359 | * Join all arguments together and normalize the resulting path.
1360 | * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
1361 | *
1362 | * @param paths string paths to join.
1363 | */
1364 | export function join(...paths: any[]): string;
1365 | /**
1366 | * Join all arguments together and normalize the resulting path.
1367 | * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
1368 | *
1369 | * @param paths string paths to join.
1370 | */
1371 | export function join(...paths: string[]): string;
1372 | /**
1373 | * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
1374 | *
1375 | * Starting from leftmost {from} paramter, resolves {to} to an absolute path.
1376 | *
1377 | * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.
1378 | *
1379 | * @param pathSegments string paths to join. Non-string arguments are ignored.
1380 | */
1381 | export function resolve(...pathSegments: any[]): string;
1382 | /**
1383 | * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
1384 | *
1385 | * @param path path to test.
1386 | */
1387 | export function isAbsolute(path: string): boolean;
1388 | /**
1389 | * Solve the relative path from {from} to {to}.
1390 | * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
1391 | *
1392 | * @param from
1393 | * @param to
1394 | */
1395 | export function relative(from: string, to: string): string;
1396 | /**
1397 | * Return the directory name of a path. Similar to the Unix dirname command.
1398 | *
1399 | * @param p the path to evaluate.
1400 | */
1401 | export function dirname(p: string): string;
1402 | /**
1403 | * Return the last portion of a path. Similar to the Unix basename command.
1404 | * Often used to extract the file name from a fully qualified path.
1405 | *
1406 | * @param p the path to evaluate.
1407 | * @param ext optionally, an extension to remove from the result.
1408 | */
1409 | export function basename(p: string, ext?: string): string;
1410 | /**
1411 | * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
1412 | * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
1413 | *
1414 | * @param p the path to evaluate.
1415 | */
1416 | export function extname(p: string): string;
1417 | /**
1418 | * The platform-specific file separator. '\\' or '/'.
1419 | */
1420 | export var sep: string;
1421 | /**
1422 | * The platform-specific file delimiter. ';' or ':'.
1423 | */
1424 | export var delimiter: string;
1425 | /**
1426 | * Returns an object from a path string - the opposite of format().
1427 | *
1428 | * @param pathString path to evaluate.
1429 | */
1430 | export function parse(pathString: string): ParsedPath;
1431 | /**
1432 | * Returns a path string from an object - the opposite of parse().
1433 | *
1434 | * @param pathString path to evaluate.
1435 | */
1436 | export function format(pathObject: ParsedPath): string;
1437 |
1438 | export module posix {
1439 | export function normalize(p: string): string;
1440 | export function join(...paths: any[]): string;
1441 | export function resolve(...pathSegments: any[]): string;
1442 | export function isAbsolute(p: string): boolean;
1443 | export function relative(from: string, to: string): string;
1444 | export function dirname(p: string): string;
1445 | export function basename(p: string, ext?: string): string;
1446 | export function extname(p: string): string;
1447 | export var sep: string;
1448 | export var delimiter: string;
1449 | export function parse(p: string): ParsedPath;
1450 | export function format(pP: ParsedPath): string;
1451 | }
1452 |
1453 | export module win32 {
1454 | export function normalize(p: string): string;
1455 | export function join(...paths: any[]): string;
1456 | export function resolve(...pathSegments: any[]): string;
1457 | export function isAbsolute(p: string): boolean;
1458 | export function relative(from: string, to: string): string;
1459 | export function dirname(p: string): string;
1460 | export function basename(p: string, ext?: string): string;
1461 | export function extname(p: string): string;
1462 | export var sep: string;
1463 | export var delimiter: string;
1464 | export function parse(p: string): ParsedPath;
1465 | export function format(pP: ParsedPath): string;
1466 | }
1467 | }
1468 |
1469 | declare module "string_decoder" {
1470 | export interface NodeStringDecoder {
1471 | write(buffer: Buffer): string;
1472 | detectIncompleteChar(buffer: Buffer): number;
1473 | }
1474 | export var StringDecoder: {
1475 | new (encoding: string): NodeStringDecoder;
1476 | };
1477 | }
1478 |
1479 | declare module "tls" {
1480 | import * as crypto from "crypto";
1481 | import * as net from "net";
1482 | import * as stream from "stream";
1483 |
1484 | var CLIENT_RENEG_LIMIT: number;
1485 | var CLIENT_RENEG_WINDOW: number;
1486 |
1487 | export interface TlsOptions {
1488 | pfx?: any; //string or buffer
1489 | key?: any; //string or buffer
1490 | passphrase?: string;
1491 | cert?: any;
1492 | ca?: any; //string or buffer
1493 | crl?: any; //string or string array
1494 | ciphers?: string;
1495 | honorCipherOrder?: any;
1496 | requestCert?: boolean;
1497 | rejectUnauthorized?: boolean;
1498 | NPNProtocols?: any; //array or Buffer;
1499 | SNICallback?: (servername: string) => any;
1500 | }
1501 |
1502 | export interface ConnectionOptions {
1503 | host?: string;
1504 | port?: number;
1505 | socket?: net.Socket;
1506 | pfx?: any; //string | Buffer
1507 | key?: any; //string | Buffer
1508 | passphrase?: string;
1509 | cert?: any; //string | Buffer
1510 | ca?: any; //Array of string | Buffer
1511 | rejectUnauthorized?: boolean;
1512 | NPNProtocols?: any; //Array of string | Buffer
1513 | servername?: string;
1514 | }
1515 |
1516 | export interface Server extends net.Server {
1517 | // Extended base methods
1518 | listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server;
1519 | listen(path: string, listeningListener?: Function): Server;
1520 | listen(handle: any, listeningListener?: Function): Server;
1521 |
1522 | listen(port: number, host?: string, callback?: Function): Server;
1523 | close(): Server;
1524 | address(): { port: number; family: string; address: string; };
1525 | addContext(hostName: string, credentials: {
1526 | key: string;
1527 | cert: string;
1528 | ca: string;
1529 | }): void;
1530 | maxConnections: number;
1531 | connections: number;
1532 | }
1533 |
1534 | export interface ClearTextStream extends stream.Duplex {
1535 | authorized: boolean;
1536 | authorizationError: Error;
1537 | getPeerCertificate(): any;
1538 | getCipher: {
1539 | name: string;
1540 | version: string;
1541 | };
1542 | address: {
1543 | port: number;
1544 | family: string;
1545 | address: string;
1546 | };
1547 | remoteAddress: string;
1548 | remotePort: number;
1549 | }
1550 |
1551 | export interface SecurePair {
1552 | encrypted: any;
1553 | cleartext: any;
1554 | }
1555 |
1556 | export interface SecureContextOptions {
1557 | pfx?: any; //string | buffer
1558 | key?: any; //string | buffer
1559 | passphrase?: string;
1560 | cert?: any; // string | buffer
1561 | ca?: any; // string | buffer
1562 | crl?: any; // string | string[]
1563 | ciphers?: string;
1564 | honorCipherOrder?: boolean;
1565 | }
1566 |
1567 | export interface SecureContext {
1568 | context: any;
1569 | }
1570 |
1571 | export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server;
1572 | export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream;
1573 | export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
1574 | export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream;
1575 | export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
1576 | export function createSecureContext(details: SecureContextOptions): SecureContext;
1577 | }
1578 |
1579 | declare module "crypto" {
1580 | export interface CredentialDetails {
1581 | pfx: string;
1582 | key: string;
1583 | passphrase: string;
1584 | cert: string;
1585 | ca: any; //string | string array
1586 | crl: any; //string | string array
1587 | ciphers: string;
1588 | }
1589 | export interface Credentials { context?: any; }
1590 | export function createCredentials(details: CredentialDetails): Credentials;
1591 | export function createHash(algorithm: string): Hash;
1592 | export function createHmac(algorithm: string, key: string): Hmac;
1593 | export function createHmac(algorithm: string, key: Buffer): Hmac;
1594 | interface Hash {
1595 | update(data: any, input_encoding?: string): Hash;
1596 | digest(encoding: 'buffer'): Buffer;
1597 | digest(encoding: string): any;
1598 | digest(): Buffer;
1599 | }
1600 | interface Hmac {
1601 | update(data: any, input_encoding?: string): Hmac;
1602 | digest(encoding: 'buffer'): Buffer;
1603 | digest(encoding: string): any;
1604 | digest(): Buffer;
1605 | }
1606 | export function createCipher(algorithm: string, password: any): Cipher;
1607 | export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
1608 | interface Cipher {
1609 | update(data: Buffer): Buffer;
1610 | update(data: string, input_encoding?: string, output_encoding?: string): string;
1611 | final(): Buffer;
1612 | final(output_encoding: string): string;
1613 | setAutoPadding(auto_padding: boolean): void;
1614 | }
1615 | export function createDecipher(algorithm: string, password: any): Decipher;
1616 | export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
1617 | interface Decipher {
1618 | update(data: Buffer): Buffer;
1619 | update(data: string, input_encoding?: string, output_encoding?: string): string;
1620 | final(): Buffer;
1621 | final(output_encoding: string): string;
1622 | setAutoPadding(auto_padding: boolean): void;
1623 | }
1624 | export function createSign(algorithm: string): Signer;
1625 | interface Signer extends NodeJS.WritableStream {
1626 | update(data: any): void;
1627 | sign(private_key: string, output_format: string): string;
1628 | }
1629 | export function createVerify(algorith: string): Verify;
1630 | interface Verify extends NodeJS.WritableStream {
1631 | update(data: any): void;
1632 | verify(object: string, signature: string, signature_format?: string): boolean;
1633 | }
1634 | export function createDiffieHellman(prime_length: number): DiffieHellman;
1635 | export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
1636 | interface DiffieHellman {
1637 | generateKeys(encoding?: string): string;
1638 | computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string;
1639 | getPrime(encoding?: string): string;
1640 | getGenerator(encoding: string): string;
1641 | getPublicKey(encoding?: string): string;
1642 | getPrivateKey(encoding?: string): string;
1643 | setPublicKey(public_key: string, encoding?: string): void;
1644 | setPrivateKey(public_key: string, encoding?: string): void;
1645 | }
1646 | export function getDiffieHellman(group_name: string): DiffieHellman;
1647 | export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void;
1648 | export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
1649 | export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer;
1650 | export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer;
1651 | export function randomBytes(size: number): Buffer;
1652 | export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
1653 | export function pseudoRandomBytes(size: number): Buffer;
1654 | export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
1655 | }
1656 |
1657 | declare module "stream" {
1658 | import * as events from "events";
1659 |
1660 | export interface Stream extends events.EventEmitter {
1661 | pipe(destination: T, options?: { end?: boolean; }): T;
1662 | }
1663 |
1664 | export interface ReadableOptions {
1665 | highWaterMark?: number;
1666 | encoding?: string;
1667 | objectMode?: boolean;
1668 | }
1669 |
1670 | export class Readable extends events.EventEmitter implements NodeJS.ReadableStream {
1671 | readable: boolean;
1672 | constructor(opts?: ReadableOptions);
1673 | _read(size: number): void;
1674 | read(size?: number): string|Buffer;
1675 | setEncoding(encoding: string): void;
1676 | pause(): void;
1677 | resume(): void;
1678 | pipe(destination: T, options?: { end?: boolean; }): T;
1679 | unpipe(destination?: T): void;
1680 | unshift(chunk: string): void;
1681 | unshift(chunk: Buffer): void;
1682 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
1683 | push(chunk: any, encoding?: string): boolean;
1684 | }
1685 |
1686 | export interface WritableOptions {
1687 | highWaterMark?: number;
1688 | decodeStrings?: boolean;
1689 | }
1690 |
1691 | export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
1692 | writable: boolean;
1693 | constructor(opts?: WritableOptions);
1694 | _write(data: Buffer, encoding: string, callback: Function): void;
1695 | _write(data: string, encoding: string, callback: Function): void;
1696 | write(buffer: Buffer, cb?: Function): boolean;
1697 | write(str: string, cb?: Function): boolean;
1698 | write(str: string, encoding?: string, cb?: Function): boolean;
1699 | end(): void;
1700 | end(buffer: Buffer, cb?: Function): void;
1701 | end(str: string, cb?: Function): void;
1702 | end(str: string, encoding?: string, cb?: Function): void;
1703 | }
1704 |
1705 | export interface DuplexOptions extends ReadableOptions, WritableOptions {
1706 | allowHalfOpen?: boolean;
1707 | }
1708 |
1709 | // Note: Duplex extends both Readable and Writable.
1710 | export class Duplex extends Readable implements NodeJS.ReadWriteStream {
1711 | writable: boolean;
1712 | constructor(opts?: DuplexOptions);
1713 | _write(data: Buffer, encoding: string, callback: Function): void;
1714 | _write(data: string, encoding: string, callback: Function): void;
1715 | write(buffer: Buffer, cb?: Function): boolean;
1716 | write(str: string, cb?: Function): boolean;
1717 | write(str: string, encoding?: string, cb?: Function): boolean;
1718 | end(): void;
1719 | end(buffer: Buffer, cb?: Function): void;
1720 | end(str: string, cb?: Function): void;
1721 | end(str: string, encoding?: string, cb?: Function): void;
1722 | }
1723 |
1724 | export interface TransformOptions extends ReadableOptions, WritableOptions {}
1725 |
1726 | // Note: Transform lacks the _read and _write methods of Readable/Writable.
1727 | export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream {
1728 | readable: boolean;
1729 | writable: boolean;
1730 | constructor(opts?: TransformOptions);
1731 | _transform(chunk: Buffer, encoding: string, callback: Function): void;
1732 | _transform(chunk: string, encoding: string, callback: Function): void;
1733 | _flush(callback: Function): void;
1734 | read(size?: number): any;
1735 | setEncoding(encoding: string): void;
1736 | pause(): void;
1737 | resume(): void;
1738 | pipe(destination: T, options?: { end?: boolean; }): T;
1739 | unpipe(destination?: T): void;
1740 | unshift(chunk: string): void;
1741 | unshift(chunk: Buffer): void;
1742 | wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
1743 | push(chunk: any, encoding?: string): boolean;
1744 | write(buffer: Buffer, cb?: Function): boolean;
1745 | write(str: string, cb?: Function): boolean;
1746 | write(str: string, encoding?: string, cb?: Function): boolean;
1747 | end(): void;
1748 | end(buffer: Buffer, cb?: Function): void;
1749 | end(str: string, cb?: Function): void;
1750 | end(str: string, encoding?: string, cb?: Function): void;
1751 | }
1752 |
1753 | export class PassThrough extends Transform {}
1754 | }
1755 |
1756 | declare module "util" {
1757 | export interface InspectOptions {
1758 | showHidden?: boolean;
1759 | depth?: number;
1760 | colors?: boolean;
1761 | customInspect?: boolean;
1762 | }
1763 |
1764 | export function format(format: any, ...param: any[]): string;
1765 | export function debug(string: string): void;
1766 | export function error(...param: any[]): void;
1767 | export function puts(...param: any[]): void;
1768 | export function print(...param: any[]): void;
1769 | export function log(string: string): void;
1770 | export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string;
1771 | export function inspect(object: any, options: InspectOptions): string;
1772 | export function isArray(object: any): boolean;
1773 | export function isRegExp(object: any): boolean;
1774 | export function isDate(object: any): boolean;
1775 | export function isError(object: any): boolean;
1776 | export function inherits(constructor: any, superConstructor: any): void;
1777 | }
1778 |
1779 | declare module "assert" {
1780 | function internal (value: any, message?: string): void;
1781 | module internal {
1782 | export class AssertionError implements Error {
1783 | name: string;
1784 | message: string;
1785 | actual: any;
1786 | expected: any;
1787 | operator: string;
1788 | generatedMessage: boolean;
1789 |
1790 | constructor(options?: {message?: string; actual?: any; expected?: any;
1791 | operator?: string; stackStartFunction?: Function});
1792 | }
1793 |
1794 | export function fail(actual?: any, expected?: any, message?: string, operator?: string): void;
1795 | export function ok(value: any, message?: string): void;
1796 | export function equal(actual: any, expected: any, message?: string): void;
1797 | export function notEqual(actual: any, expected: any, message?: string): void;
1798 | export function deepEqual(actual: any, expected: any, message?: string): void;
1799 | export function notDeepEqual(acutal: any, expected: any, message?: string): void;
1800 | export function strictEqual(actual: any, expected: any, message?: string): void;
1801 | export function notStrictEqual(actual: any, expected: any, message?: string): void;
1802 | export var throws: {
1803 | (block: Function, message?: string): void;
1804 | (block: Function, error: Function, message?: string): void;
1805 | (block: Function, error: RegExp, message?: string): void;
1806 | (block: Function, error: (err: any) => boolean, message?: string): void;
1807 | };
1808 |
1809 | export var doesNotThrow: {
1810 | (block: Function, message?: string): void;
1811 | (block: Function, error: Function, message?: string): void;
1812 | (block: Function, error: RegExp, message?: string): void;
1813 | (block: Function, error: (err: any) => boolean, message?: string): void;
1814 | };
1815 |
1816 | export function ifError(value: any): void;
1817 | }
1818 |
1819 | export = internal;
1820 | }
1821 |
1822 | declare module "tty" {
1823 | import * as net from "net";
1824 |
1825 | export function isatty(fd: number): boolean;
1826 | export interface ReadStream extends net.Socket {
1827 | isRaw: boolean;
1828 | setRawMode(mode: boolean): void;
1829 | }
1830 | export interface WriteStream extends net.Socket {
1831 | columns: number;
1832 | rows: number;
1833 | }
1834 | }
1835 |
1836 | declare module "domain" {
1837 | import * as events from "events";
1838 |
1839 | export class Domain extends events.EventEmitter {
1840 | run(fn: Function): void;
1841 | add(emitter: events.EventEmitter): void;
1842 | remove(emitter: events.EventEmitter): void;
1843 | bind(cb: (err: Error, data: any) => any): any;
1844 | intercept(cb: (data: any) => any): any;
1845 | dispose(): void;
1846 |
1847 | addListener(event: string, listener: Function): Domain;
1848 | on(event: string, listener: Function): Domain;
1849 | once(event: string, listener: Function): Domain;
1850 | removeListener(event: string, listener: Function): Domain;
1851 | removeAllListeners(event?: string): Domain;
1852 | }
1853 |
1854 | export function create(): Domain;
1855 | }
1856 |
1857 | declare module "constants" {
1858 | export var E2BIG: number;
1859 | export var EACCES: number;
1860 | export var EADDRINUSE: number;
1861 | export var EADDRNOTAVAIL: number;
1862 | export var EAFNOSUPPORT: number;
1863 | export var EAGAIN: number;
1864 | export var EALREADY: number;
1865 | export var EBADF: number;
1866 | export var EBADMSG: number;
1867 | export var EBUSY: number;
1868 | export var ECANCELED: number;
1869 | export var ECHILD: number;
1870 | export var ECONNABORTED: number;
1871 | export var ECONNREFUSED: number;
1872 | export var ECONNRESET: number;
1873 | export var EDEADLK: number;
1874 | export var EDESTADDRREQ: number;
1875 | export var EDOM: number;
1876 | export var EEXIST: number;
1877 | export var EFAULT: number;
1878 | export var EFBIG: number;
1879 | export var EHOSTUNREACH: number;
1880 | export var EIDRM: number;
1881 | export var EILSEQ: number;
1882 | export var EINPROGRESS: number;
1883 | export var EINTR: number;
1884 | export var EINVAL: number;
1885 | export var EIO: number;
1886 | export var EISCONN: number;
1887 | export var EISDIR: number;
1888 | export var ELOOP: number;
1889 | export var EMFILE: number;
1890 | export var EMLINK: number;
1891 | export var EMSGSIZE: number;
1892 | export var ENAMETOOLONG: number;
1893 | export var ENETDOWN: number;
1894 | export var ENETRESET: number;
1895 | export var ENETUNREACH: number;
1896 | export var ENFILE: number;
1897 | export var ENOBUFS: number;
1898 | export var ENODATA: number;
1899 | export var ENODEV: number;
1900 | export var ENOENT: number;
1901 | export var ENOEXEC: number;
1902 | export var ENOLCK: number;
1903 | export var ENOLINK: number;
1904 | export var ENOMEM: number;
1905 | export var ENOMSG: number;
1906 | export var ENOPROTOOPT: number;
1907 | export var ENOSPC: number;
1908 | export var ENOSR: number;
1909 | export var ENOSTR: number;
1910 | export var ENOSYS: number;
1911 | export var ENOTCONN: number;
1912 | export var ENOTDIR: number;
1913 | export var ENOTEMPTY: number;
1914 | export var ENOTSOCK: number;
1915 | export var ENOTSUP: number;
1916 | export var ENOTTY: number;
1917 | export var ENXIO: number;
1918 | export var EOPNOTSUPP: number;
1919 | export var EOVERFLOW: number;
1920 | export var EPERM: number;
1921 | export var EPIPE: number;
1922 | export var EPROTO: number;
1923 | export var EPROTONOSUPPORT: number;
1924 | export var EPROTOTYPE: number;
1925 | export var ERANGE: number;
1926 | export var EROFS: number;
1927 | export var ESPIPE: number;
1928 | export var ESRCH: number;
1929 | export var ETIME: number;
1930 | export var ETIMEDOUT: number;
1931 | export var ETXTBSY: number;
1932 | export var EWOULDBLOCK: number;
1933 | export var EXDEV: number;
1934 | export var WSAEINTR: number;
1935 | export var WSAEBADF: number;
1936 | export var WSAEACCES: number;
1937 | export var WSAEFAULT: number;
1938 | export var WSAEINVAL: number;
1939 | export var WSAEMFILE: number;
1940 | export var WSAEWOULDBLOCK: number;
1941 | export var WSAEINPROGRESS: number;
1942 | export var WSAEALREADY: number;
1943 | export var WSAENOTSOCK: number;
1944 | export var WSAEDESTADDRREQ: number;
1945 | export var WSAEMSGSIZE: number;
1946 | export var WSAEPROTOTYPE: number;
1947 | export var WSAENOPROTOOPT: number;
1948 | export var WSAEPROTONOSUPPORT: number;
1949 | export var WSAESOCKTNOSUPPORT: number;
1950 | export var WSAEOPNOTSUPP: number;
1951 | export var WSAEPFNOSUPPORT: number;
1952 | export var WSAEAFNOSUPPORT: number;
1953 | export var WSAEADDRINUSE: number;
1954 | export var WSAEADDRNOTAVAIL: number;
1955 | export var WSAENETDOWN: number;
1956 | export var WSAENETUNREACH: number;
1957 | export var WSAENETRESET: number;
1958 | export var WSAECONNABORTED: number;
1959 | export var WSAECONNRESET: number;
1960 | export var WSAENOBUFS: number;
1961 | export var WSAEISCONN: number;
1962 | export var WSAENOTCONN: number;
1963 | export var WSAESHUTDOWN: number;
1964 | export var WSAETOOMANYREFS: number;
1965 | export var WSAETIMEDOUT: number;
1966 | export var WSAECONNREFUSED: number;
1967 | export var WSAELOOP: number;
1968 | export var WSAENAMETOOLONG: number;
1969 | export var WSAEHOSTDOWN: number;
1970 | export var WSAEHOSTUNREACH: number;
1971 | export var WSAENOTEMPTY: number;
1972 | export var WSAEPROCLIM: number;
1973 | export var WSAEUSERS: number;
1974 | export var WSAEDQUOT: number;
1975 | export var WSAESTALE: number;
1976 | export var WSAEREMOTE: number;
1977 | export var WSASYSNOTREADY: number;
1978 | export var WSAVERNOTSUPPORTED: number;
1979 | export var WSANOTINITIALISED: number;
1980 | export var WSAEDISCON: number;
1981 | export var WSAENOMORE: number;
1982 | export var WSAECANCELLED: number;
1983 | export var WSAEINVALIDPROCTABLE: number;
1984 | export var WSAEINVALIDPROVIDER: number;
1985 | export var WSAEPROVIDERFAILEDINIT: number;
1986 | export var WSASYSCALLFAILURE: number;
1987 | export var WSASERVICE_NOT_FOUND: number;
1988 | export var WSATYPE_NOT_FOUND: number;
1989 | export var WSA_E_NO_MORE: number;
1990 | export var WSA_E_CANCELLED: number;
1991 | export var WSAEREFUSED: number;
1992 | export var SIGHUP: number;
1993 | export var SIGINT: number;
1994 | export var SIGILL: number;
1995 | export var SIGABRT: number;
1996 | export var SIGFPE: number;
1997 | export var SIGKILL: number;
1998 | export var SIGSEGV: number;
1999 | export var SIGTERM: number;
2000 | export var SIGBREAK: number;
2001 | export var SIGWINCH: number;
2002 | export var SSL_OP_ALL: number;
2003 | export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
2004 | export var SSL_OP_CIPHER_SERVER_PREFERENCE: number;
2005 | export var SSL_OP_CISCO_ANYCONNECT: number;
2006 | export var SSL_OP_COOKIE_EXCHANGE: number;
2007 | export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
2008 | export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
2009 | export var SSL_OP_EPHEMERAL_RSA: number;
2010 | export var SSL_OP_LEGACY_SERVER_CONNECT: number;
2011 | export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number;
2012 | export var SSL_OP_MICROSOFT_SESS_ID_BUG: number;
2013 | export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number;
2014 | export var SSL_OP_NETSCAPE_CA_DN_BUG: number;
2015 | export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number;
2016 | export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number;
2017 | export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number;
2018 | export var SSL_OP_NO_COMPRESSION: number;
2019 | export var SSL_OP_NO_QUERY_MTU: number;
2020 | export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
2021 | export var SSL_OP_NO_SSLv2: number;
2022 | export var SSL_OP_NO_SSLv3: number;
2023 | export var SSL_OP_NO_TICKET: number;
2024 | export var SSL_OP_NO_TLSv1: number;
2025 | export var SSL_OP_NO_TLSv1_1: number;
2026 | export var SSL_OP_NO_TLSv1_2: number;
2027 | export var SSL_OP_PKCS1_CHECK_1: number;
2028 | export var SSL_OP_PKCS1_CHECK_2: number;
2029 | export var SSL_OP_SINGLE_DH_USE: number;
2030 | export var SSL_OP_SINGLE_ECDH_USE: number;
2031 | export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number;
2032 | export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number;
2033 | export var SSL_OP_TLS_BLOCK_PADDING_BUG: number;
2034 | export var SSL_OP_TLS_D5_BUG: number;
2035 | export var SSL_OP_TLS_ROLLBACK_BUG: number;
2036 | export var ENGINE_METHOD_DSA: number;
2037 | export var ENGINE_METHOD_DH: number;
2038 | export var ENGINE_METHOD_RAND: number;
2039 | export var ENGINE_METHOD_ECDH: number;
2040 | export var ENGINE_METHOD_ECDSA: number;
2041 | export var ENGINE_METHOD_CIPHERS: number;
2042 | export var ENGINE_METHOD_DIGESTS: number;
2043 | export var ENGINE_METHOD_STORE: number;
2044 | export var ENGINE_METHOD_PKEY_METHS: number;
2045 | export var ENGINE_METHOD_PKEY_ASN1_METHS: number;
2046 | export var ENGINE_METHOD_ALL: number;
2047 | export var ENGINE_METHOD_NONE: number;
2048 | export var DH_CHECK_P_NOT_SAFE_PRIME: number;
2049 | export var DH_CHECK_P_NOT_PRIME: number;
2050 | export var DH_UNABLE_TO_CHECK_GENERATOR: number;
2051 | export var DH_NOT_SUITABLE_GENERATOR: number;
2052 | export var NPN_ENABLED: number;
2053 | export var RSA_PKCS1_PADDING: number;
2054 | export var RSA_SSLV23_PADDING: number;
2055 | export var RSA_NO_PADDING: number;
2056 | export var RSA_PKCS1_OAEP_PADDING: number;
2057 | export var RSA_X931_PADDING: number;
2058 | export var RSA_PKCS1_PSS_PADDING: number;
2059 | export var POINT_CONVERSION_COMPRESSED: number;
2060 | export var POINT_CONVERSION_UNCOMPRESSED: number;
2061 | export var POINT_CONVERSION_HYBRID: number;
2062 | export var O_RDONLY: number;
2063 | export var O_WRONLY: number;
2064 | export var O_RDWR: number;
2065 | export var S_IFMT: number;
2066 | export var S_IFREG: number;
2067 | export var S_IFDIR: number;
2068 | export var S_IFCHR: number;
2069 | export var S_IFLNK: number;
2070 | export var O_CREAT: number;
2071 | export var O_EXCL: number;
2072 | export var O_TRUNC: number;
2073 | export var O_APPEND: number;
2074 | export var F_OK: number;
2075 | export var R_OK: number;
2076 | export var W_OK: number;
2077 | export var X_OK: number;
2078 | export var UV_UDP_REUSEADDR: number;
2079 | }
2080 |
--------------------------------------------------------------------------------