| 89 | } |
| 90 | |
| 91 | async readFile(filePath: string, options: BufferEncoding | { encoding?: BufferEncoding } = {}) { |
| 92 | filePath = path.normalize(filePath); |
| 93 | |
| 94 | if (typeof options === 'string') { |
| 95 | options = { |
| 96 | encoding: options, |
| 97 | }; |
| 98 | } |
| 99 | |
| 100 | const encoding = options ? options.encoding : null; |
| 101 | |
| 102 | const entry = this._assertFile(filePath); |
| 103 | |
| 104 | const raw = Buffer.from(entry.contents, 'base64'); |
| 105 | |
| 106 | if (encoding) { |
| 107 | return raw.toString(encoding); |
| 108 | } |
| 109 | return raw; |
| 110 | } |
| 111 | |
| 112 | async writeFile( |
| 113 | filePath: string, |