diff --git a/express/express.d.ts b/express/express.d.ts
index e2f6d5df21..523f8f7c6f 100644
--- a/express/express.d.ts
+++ b/express/express.d.ts
@@ -108,6 +108,8 @@ declare module "express" {
use(path: string, handler: ErrorRequestHandler): T;
use(path: string[], ...handler: RequestHandler[]): T;
use(path: string[], handler: ErrorRequestHandler): T;
+ use(path: RegExp, ...handler: RequestHandler[]): T;
+ use(path: RegExp, handler: ErrorRequestHandler): T;
}
export function Router(options?: any): Router;
diff --git a/node/node-tests.ts b/node/node-tests.ts
index bb0c5f678e..bd80329dca 100644
--- a/node/node-tests.ts
+++ b/node/node-tests.ts
@@ -13,6 +13,7 @@ import * as dgram from "dgram";
import * as querystring from "querystring";
import * as path from "path";
import * as readline from "readline";
+import * as childProcess from "child_process";
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
@@ -401,3 +402,10 @@ rl.prompt(true);
rl.question("do you like typescript?", function(answer: string) {
rl.close();
});
+
+//////////////////////////////////////////////////////////////////////
+/// Child Process tests: https://nodejs.org/api/child_process.html ///
+//////////////////////////////////////////////////////////////////////
+
+childProcess.exec("echo test");
+childProcess.spawnSync("echo test");
diff --git a/node/node.d.ts b/node/node.d.ts
index b1436e16a1..458ed27cc8 100644
--- a/node/node.d.ts
+++ b/node/node.d.ts
@@ -868,6 +868,26 @@ declare module "child_process" {
env?: any;
encoding?: string;
}): ChildProcess;
+ export function spawnSync(command: string, args?: string[], options?: {
+ cwd?: string;
+ input?: string | Buffer;
+ stdio?: any;
+ env?: any;
+ uid?: number;
+ gid?: number;
+ timeout?: number;
+ maxBuffer?: number;
+ killSignal?: string;
+ encoding?: string;
+ }): {
+ pid: number;
+ output: string[];
+ stdout: string | Buffer;
+ stderr: string | Buffer;
+ status: number;
+ signal: string;
+ error: Error;
+ };
export function execSync(command: string, options?: {
cwd?: string;
input?: string|Buffer;
diff --git a/pngjs2/pngjs2-tests.ts b/pngjs2/pngjs2-tests.ts
new file mode 100644
index 0000000000..ae2d73e7b3
--- /dev/null
+++ b/pngjs2/pngjs2-tests.ts
@@ -0,0 +1,26 @@
+///
+
+import * as fs from "fs";
+import { PNG } from "pngjs2";
+
+let png = new PNG({ filterType: 4 });
+
+fs.createReadStream("in.png")
+ .pipe(png)
+ .on("parsed", () => {
+ for (let y = 0; y < png.height; y++) {
+ for (let x = 0; x < png.width; x++) {
+ let idx = (png.width * y + x) << 2;
+
+ // invert color
+ png.data[idx] = 255 - png.data[idx];
+ png.data[idx+1] = 255 - png.data[idx+1];
+ png.data[idx+2] = 255 - png.data[idx+2];
+
+ // and reduce opacity
+ png.data[idx+3] = png.data[idx+3] >> 1;
+ }
+ }
+
+ png.pack().pipe(fs.createWriteStream('out.png'));
+ });
diff --git a/pngjs2/pngjs2.d.ts b/pngjs2/pngjs2.d.ts
new file mode 100644
index 0000000000..e44dbfdd69
--- /dev/null
+++ b/pngjs2/pngjs2.d.ts
@@ -0,0 +1,64 @@
+// Type definitions for pngjs2 2.0.0
+// Project: https://www.npmjs.com/package/pngjs2
+// Definitions by: Elisée Maurer
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "pngjs2" {
+ import fs = require("fs");
+ import events = require("events");
+ import stream = require("stream");
+
+ interface PNGOptions {
+ width?: number;
+ height?: number;
+ checkCRC?: boolean;
+ deflateChunkSize?: number;
+ deflateLevel?: number;
+ deflateStrategy?: number;
+ deflateFactory?: any;
+ filterType?: number|number[];
+ colorType?: number;
+ inputHasAlpha?: boolean;
+ }
+
+ interface PNGMetadata {
+ width: number;
+ height: number;
+ palette: boolean;
+ color: boolean;
+ alpha: boolean;
+ interlace: boolean;
+ }
+
+ export class PNG extends stream.Writable {
+ constructor(options?: PNGOptions);
+
+ width: number;
+ height: number;
+ data: Buffer;
+ gamma: number;
+
+ on(event: string, callback: Function): PNG;
+ on(event: "metadata", callback: (metadata: PNGMetadata) => void): PNG;
+ on(event: "parsed", callback: (data: Buffer) => void): PNG;
+ on(event: "error", callback: (err: Error) => void): PNG;
+
+ parse(data: string|Buffer, callback?: (err: Error, data: Buffer) => void): PNG;
+ pack(): PNG;
+ pipe(destination: fs.WriteStream): PNG;
+
+ static bitblt(src: PNG, dst: PNG, srcX: number, srcY: number,
+ width: number, height: number, deltaX: number, deltaY: number): void;
+
+ bitblt(dst: PNG, srcX: number, srcY: number,
+ width: number, height: number, deltaX: number, deltaY: number): PNG;
+ }
+
+ export namespace PNG {
+ namespace sync {
+ function read(buffer: string|Buffer, options?: PNGOptions): PNG;
+ }
+ }
+}