diff --git a/sax/sax-tests.ts b/sax/sax-tests.ts
new file mode 100644
index 0000000000..3eeecc4fc3
--- /dev/null
+++ b/sax/sax-tests.ts
@@ -0,0 +1,43 @@
+///
+///
+import sax = require("sax");
+
+var opts: sax.SAXOptions = {
+ lowercase: true,
+ normalize: true,
+ xmlns: true,
+ position: true
+};
+
+var parser = sax.parser(/*strict=*/true, opts);
+
+parser.onerror = function(e: Error) {
+};
+
+parser.ontext = function(text: string) {
+};
+
+parser.onopentag = function(tag: sax.Tag) {
+};
+
+parser.onattribute = function(attr: { name: string; value: string; }) {
+};
+
+parser.onend = function() {
+};
+
+parser.write("Hello, world!").close();
+
+
+var saxStream = sax.createStream(/*strict=*/true, opts);
+
+saxStream.on("error", function(e: Error) {
+ this._parser.error = null;
+ this._parser.resume();
+});
+
+import fs = require("fs");
+fs.createReadStream("file.xml")
+ .pipe(saxStream)
+ .pipe(fs.createWriteStream("file-copy.xml"));
+
diff --git a/sax/sax.d.ts b/sax/sax.d.ts
new file mode 100644
index 0000000000..fb3d7e7859
--- /dev/null
+++ b/sax/sax.d.ts
@@ -0,0 +1,78 @@
+// Type definitions for sax js
+// Project: https://github.com/isaacs/sax-js
+// Definitions by: Asana
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+///
+
+declare module "sax" {
+ export var EVENTS: string[];
+
+ interface SAXOptions {
+ trim?: boolean;
+ normalize?: boolean;
+ lowercase?: boolean;
+ xmlns?: boolean;
+ noscript?: boolean;
+ position?: boolean;
+ }
+
+ export interface Tag {
+ name: string;
+ attributes: { [key: string]: string };
+
+ // Available if opt.xmlns
+ ns?: { [key: string]: string };
+ prefix?: string;
+ local?: string;
+ uri?: string;
+ }
+
+ export function parser(strict: boolean, opt: SAXOptions): SAXParser;
+ export class SAXParser {
+ constructor(strict: boolean, opt: SAXOptions);
+
+ // Methods
+ end(): void;
+ write(s: string): SAXParser;
+ resume(): SAXParser;
+ close(): SAXParser;
+ flush(): void;
+
+ // Members
+ line: number;
+ column: number;
+ error: Error;
+ position: number;
+ startTagPosition: number;
+ closed: boolean;
+ strict: boolean;
+ opt: SAXOptions;
+ tag: string;
+
+ // Events
+ onerror(e: Error): void;
+ ontext(t: string): void;
+ ondoctype(doctype: string): void;
+ onprocessinginstruction(node: { name: string; body: string }): void;
+ onopentag(tag: Tag): void;
+ onclosetag(tagName: string): void;
+ onattribute(attr: { name: string; value: string }): void;
+ oncomment(comment: string): void;
+ onopencdata(): void;
+ oncdata(cdata: string): void;
+ onclosecdata(): void;
+ onopennamespace(ns: { prefix: string; uri: string }): void;
+ onclosenamespace(ns: { prefix: string; uri: string }): void;
+ onend(): void;
+ onready(): void;
+ onscript(script: string): void;
+ }
+
+ import stream = require("stream");
+ export function createStream(strict: boolean, opt: SAXOptions): SAXStream;
+ export class SAXStream extends stream.Duplex {
+ constructor(strict: boolean, opt: SAXOptions);
+ private _parser: SAXParser;
+ }
+}
+