S
S
Sergey Zolotarev2021-09-15 11:42:28
Node.js
Sergey Zolotarev, 2021-09-15 11:42:28

How to fix file read error in createReadStream method of FS module?

Good day!

A few minutes ago, I encountered an error that was made after I integrated the FS module with a library for reading CSV files :

TypeError: Cannot read properties of undefined (reading 'createReadStream')

And the compiler referred to the problematic piece of code:
9 | const CsvReadableStream = require('csv-reader');
  10 | 
  11 | 
> 12 | let inputDataset = [
  13 | 			Fsp.createReadStream('../datasets/productCategories.csv', 'utf8').pipe(new CsvReadableStream({ parseNumbers: true, parseStrings: true, trim: true }))
  14 | ];
  15 |

What is wrong in the example code? The full version of the problematic TypeScript code is in the comments to this question!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question