mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
To have no separator, `tail` docs specify to pass `null`, so it should be valid to pass. See: https://www.npmjs.com/package/tail#constructor-parameters >separator: the line separator token (default: /[\r]{0,1}\n/ to handle linux/mac (9+)/windows). **Pass null if your file is binary there's no >line separator.**
41 lines
1.2 KiB
TypeScript
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 | null;
|
|
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;
|