1 | /// <reference types="node" />
|
2 | import { Logger } from "oly-core";
|
3 | /**
|
4 | *
|
5 | */
|
6 | export declare class FileService {
|
7 | protected logger: Logger;
|
8 | /**
|
9 | * Check if file exists.
|
10 | *
|
11 | * @param filepath Absolute path
|
12 | */
|
13 | exists(filepath: string): Promise<boolean>;
|
14 | /**
|
15 | * Read a file.
|
16 | *
|
17 | * @param filepath Absolute path
|
18 | * @param options Encoding and flag
|
19 | */
|
20 | read(filepath: string, options: {
|
21 | encoding: "UTF-8";
|
22 | flag?: string;
|
23 | }): Promise<string>;
|
24 | /**
|
25 | * Write a file.
|
26 | *
|
27 | * @param filepath Absolute path
|
28 | * @param data Data
|
29 | * @param options Encode, mode and flag
|
30 | */
|
31 | write(filepath: string, data: string | Buffer, options?: {
|
32 | encoding?: string;
|
33 | mode?: number;
|
34 | flag?: string;
|
35 | }): Promise<void>;
|
36 | /**
|
37 | * Move a file.
|
38 | *
|
39 | * @param filepath Source
|
40 | * @param destination Destination
|
41 | */
|
42 | move(filepath: string, destination: string): Promise<void>;
|
43 | /**
|
44 | * Copy a file.
|
45 | *
|
46 | * @param filepath Source
|
47 | * @param destination Destination
|
48 | */
|
49 | copy(filepath: string, destination: string): Promise<void>;
|
50 | /**
|
51 | * Remove directory/file.
|
52 | *
|
53 | * @param filepath Absolute path
|
54 | */
|
55 | remove(filepath: string): Promise<void>;
|
56 | /**
|
57 | * Ensure directory.
|
58 | *
|
59 | * @param filepath Absolute path
|
60 | */
|
61 | mkdirp(filepath: string): Promise<void>;
|
62 | }
|