UNPKG

993 BTypeScriptView Raw
1import { lines } from 'mrm-core';
2import { File } from '../Base/File';
3/**
4 * Base class to work with raw text new line files. For example `.env`
5 * file or `.gitignore`
6 */
7export declare class NewLineFile extends File {
8 filePointer: ReturnType<typeof lines>;
9 protected actions: never[];
10 constructor(basePath: string, filename: string);
11 /**
12 * Add one or more new lines
13 */
14 add(line: string | string[]): this;
15 /**
16 * Update existing text with new text
17 */
18 update(oldText: string, newText: string): this;
19 /**
20 * Remove lines matching the give text
21 */
22 remove(line: string | string[]): this;
23 /**
24 * Delete file
25 */
26 delete(): this;
27 /**
28 * Get contents for the file
29 */
30 get(): string[];
31 /**
32 * A boolean telling if the file already exists
33 */
34 exists(): boolean;
35 /**
36 * Commit mutations
37 */
38 commit(): void;
39 /**
40 * Rollback mutations
41 */
42 rollback(): void;
43}