diff options
Diffstat (limited to 'src/sources/FileSource.ts')
| -rw-r--r-- | src/sources/FileSource.ts | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/sources/FileSource.ts b/src/sources/FileSource.ts deleted file mode 100644 index 57e51ae..0000000 --- a/src/sources/FileSource.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {readFile} from 'fs'; - -import {ISource} from './ISource'; - -export class FileSource implements ISource { - private _path: string; - private _data: string = null; - - constructor(course: string) { - } - - getData(weekOfYear: number): Promise<string> { - if (this._data) { - return Promise.resolve(this._data); - } - - return new Promise<string>((resolve, reject) => { - readFile(this._path, (err, data) => { - if (err) return reject(err); - - this._data = data.toString(); - resolve(this._data); - }); - }); - } -} |
