DefinitelyTyped/types/tail/index.d.ts
Nathan Shively-Sanders f0ce987bc1 Update project urls to match NPM url
Note that this *trivially* updates project urls by adding the NPM url to
the end, even when the urls are almost identical or the DT one is
outdated. I'll clean up the urls in a later commit.

This PR is unfinished! Please do not merge it yet.
2019-02-11 17:10:55 -08:00

41 lines
1.2 KiB
TypeScript

// Type definitions for tail 1.2
// Project: https://github.com/lucagrulla/node-tail, https://www.lucagrulla.com/node-tail
// Definitions by: Mike Linkovich <https://github.com/spacejack>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
declare namespace Tail {
interface TailOptions {
separator?: string | RegExp;
fromBeginning?: boolean;
fsWatchOptions?: Record<string, any>;
follow?: boolean;
logger?: any;
encoding?: string;
useWatchFile?: boolean;
}
interface Tail {
/** Callback to listen for newlines appended to file */
on(eventType: 'line', cb: (data: any) => void): void;
/** Error callback */
on(eventType: 'error', cb: (error: any) => void): void;
/** Stop watching file */
unwatch(): void;
/** Start watching file if previously stopped */
watch(): void;
}
interface TailConstructor {
/** Creates a new Tail object that starts watching the specified file immediately. */
new(filename: string, options?: TailOptions): Tail;
}
interface Static {
Tail: TailConstructor;
}
}
declare const Tail: Tail.Static;
export = Tail;