Did you find any solution ? i am facing the same issue.
On Friday, August 5, 2016 at 8:21:10 PM UTC+5:30, Raj Kumar 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/de278afe-82be-478c-b18f-b6e4b0b7f725%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.