Guest User

Untitled

a guest
May 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. const import_csv = id => {
  2. this.id = id;
  3.  
  4. this.file = function (filePath, separator = ';', encoding = 'win1252') {
  5. this.filePath = filePath;
  6. this.separator = separator;
  7. this.encoding = encoding;
  8.  
  9. this.stream = fs.createReadStream(filePath)
  10. .pipe(iconv.decodeStream(encoding))
  11. .pipe(parser({ separator: separator }));
  12.  
  13. return this;
  14. };
Add Comment
Please, Sign In to add comment