* Special XHR function: Preload the given file into the index. * @param [String] path * @param [BrowserFS.Buffer] buffer
(path: string, buffer: Buffer)
| 195 | * @param [BrowserFS.Buffer] buffer |
| 196 | */ |
| 197 | public preloadFile(path: string, buffer: Buffer): void { |
| 198 | const inode = this._index.getInode(path); |
| 199 | if (isFileInode<Stats>(inode)) { |
| 200 | if (inode === null) { |
| 201 | throw ApiError.ENOENT(path); |
| 202 | } |
| 203 | const stats = inode.getData(); |
| 204 | stats.size = buffer.length; |
| 205 | stats.fileData = buffer; |
| 206 | } else { |
| 207 | throw ApiError.EISDIR(path); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | public stat(path: string, isLstat: boolean, cb: BFSCallback<Stats>): void { |
| 212 | const inode = this._index.getInode(path); |
nothing calls this directly
no test coverage detected