1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const AbstractFile_1 = require("../support/AbstractFile");
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | class InMemoryFile extends AbstractFile_1.AbstractFile {
|
10 | constructor(path, content) {
|
11 | super();
|
12 | this.path = path;
|
13 | this.content = content;
|
14 | this.initialPath = path;
|
15 | this.initialContent = content;
|
16 | }
|
17 | getContentSync() {
|
18 | return this.content;
|
19 | }
|
20 | setContentSync(content) {
|
21 | this.content = content;
|
22 | return this;
|
23 | }
|
24 | setContent(content) {
|
25 | return Promise.resolve(this.setContentSync(content));
|
26 | }
|
27 | getContent() {
|
28 | return Promise.resolve(this.getContentSync());
|
29 | }
|
30 | setPath(path) {
|
31 | this.path = path;
|
32 | return Promise.resolve(this);
|
33 | }
|
34 | get dirty() {
|
35 | return this.initialContent !== this.getContentSync() || this.initialPath !== this.path || super.dirty;
|
36 | }
|
37 | isExecutable() {
|
38 | throw new Error("isExecutable is not implemented here");
|
39 | }
|
40 | isReadable() {
|
41 | throw new Error("isReadable is not implemented here");
|
42 | }
|
43 | isBinary() {
|
44 |
|
45 | return Promise.resolve(false);
|
46 | }
|
47 | }
|
48 | exports.InMemoryFile = InMemoryFile;
|
49 |
|
\ | No newline at end of file |