I am facing this problem too, did you found any resolution ?
On Friday, 5 August 2016 20:21:10 UTC+5:30, Raj Kumar Verma wrote:
>
> How i can stop reading csv rows at some particular index using fast-csv
> node module? In fast-csv their is option for stream pause and resume but no
> option to close stream at some particular row. Following is the code :
>
> var csvstream = CSV
> .fromPath(self.fetchFilePath(fileName),{ ltrim : true, rtrim : true , headers
> : true , ignoreEmpty : true })
> .transform(function (data){
> Object.keys(data).forEach(function (key) {
> var newKey = key.trim();
> data[newKey] = data[key].trim();
> });
> return data;
> })
> .on("data", function(data){
> //checking unicode char presence
> Object.keys(data).forEach(function (key) {
> if(data[key]){
> var charValue = PUNYCODE.ucs2.decode(data[key]);
> charValue = charValue.map(function(val) {
> if(val>126){
> FileCleanFlag=false;
> errorData.push(data);
> }
> });
> }else{
> FileCleanFlag=false;
> }
> });
>
> if(!FileCleanFlag){
> #here want to jump to end block instead of parsing next rows
> }
> })
> .on('end', function (){
> #some work on rows containing error
> });
>
>
> In above code how i can jump to "end" block if error occur in some row?
>
>
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/817f4db3-9228-47c6-bde2-9ae9978ff639%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.