added definition for ncp

This commit is contained in:
Bart van der Schoor 2014-06-19 16:56:50 +02:00
parent 6745ac3279
commit 76b240a5d3
2 changed files with 51 additions and 0 deletions

32
ncp/ncp-tests.ts Normal file
View File

@ -0,0 +1,32 @@
/// <reference path="ncp.d.ts" />
import ncp = require('ncp');
import stream = require('stream');
var opts: ncp.Options;
opts = {};
opts = {
filter: /abc/
};
opts = {
transform: (read: NodeJS.ReadableStream, write: NodeJS.WritableStream) => {
}
};
opts = {
clobber: false
};
opts = {
stopOnErr: false
};
opts = {
errs: new stream.Writable()
};
ncp.ncp('foo', 'bar', (err: Error) => {
});
ncp.ncp('foo', 'bar', opts, (err: Error) => {
});

19
ncp/ncp.d.ts vendored Normal file
View File

@ -0,0 +1,19 @@
// Type definitions for ncp v0.5.1
// Project: https://github.com/AvianFlu/ncp
// Definitions by: Bart van der Schoor <https://github.com/bartvds/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'ncp' {
function ncp (source: string, destination: string, callback: (err: Error) => void): void;
function ncp (source: string, destination: string, options: Options, callback: (err: Error) => void): void;
interface Options {
filter? : RegExp;
transform? : (read: NodeJS.ReadableStream, write: NodeJS.WritableStream) => void;
clobber? : boolean;
stopOnErr? : boolean;
errs? : NodeJS.WritableStream;
}
}