diff --git a/lesson_10/libraries/src/loaders/chigazo_graham_loader.ts b/lesson_10/libraries/src/loaders/chigazo_graham_loader.ts index 984902ef..469de58f 100644 --- a/lesson_10/libraries/src/loaders/chigazo_graham_loader.ts +++ b/lesson_10/libraries/src/loaders/chigazo_graham_loader.ts @@ -21,10 +21,10 @@ export class ChigazoGrahamLoader implements Loader { async loadMediaItems(): Promise { // TODO: Implement this method. - const mediaItems: MediaItem[] = []; - const readable = fs.readFileSync('data/media_items.csv', { - encoding: 'utf-8' - }); + const mediaItems = []; + const readable = fs + .createReadStream('data/credits.csv', 'utf-8') + .pipe(csv()); for await (const row of readable) { const { id, type, title, genre, year } = row; mediaItems.push(new MediaItem( id, type, title, genre, year, ));