[nodejs] New module asn1-ber released - a clone of the unmaintained asn1 project

2017-07-24 Thread Stephen Vickers
Hi All,

The asn1 module which is heavily depended on has received little attention 
over the past few years, so I have cloned the project and made a commitment 
to address all outstanding issues and pull requests, and maintain it going 
forward as a drop in replacement for asn1, i.e. where you would normally:

var asn1 = require("asn1")

You can simply replace this with:

var asn1 = require("asn1-ber")

I have taken the time to document it's public interface too, which can now 
access on npm:

https://www.npmjs.com/package/asn1-ber

I have updated my own net-snmp project to now depend on this new module, 
feel free to do the same.

Nearly all the outstanding issues and pull requests have been addressed, 
for details see the release notes in the docs here:

https://www.npmjs.com/package/asn1-ber#version-100---22072017

Steve

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/db78ca4c-5a37-4c54-8668-f4bc9789f3f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Re: outside for loop var value is undefined

2017-07-24 Thread Zlatko
The problem is that your last console.log line runs before anything else.

I don't see the rest of the code, but I suspect if you move your *return 
resolve(countRepetidos);* 2 lines up (right behind that *if(data.count>0) 
{}* block), your promise will resolve proper value.

Likewise, if you put the console log there, it's going to work.



On Saturday, July 22, 2017 at 3:50:01 AM UTC+2, Catia Matos wrote:
>
>
> 0down votefavorite 
> 
>
> I'm facing a problem with a value where inside my for cycle it has values 
> like "179" and outside i get always undefined. Why?
>
> var countRepetidos;if(obj.data.list!={} && obj.data.list.length>0){
> var aux = obj.data["list"];
> countRepetidos=0;
> for(var i=0;iDatabase.Probing.getMacAdress(aux[i]).then(function(data){
> if(data.count>0){
>countRepetidos++;  
>console.log("count repetidos 1",countRepetidos); // value 116
> }   
> });
> }
> return resolve(countRepetidos);}   
>
> console.log("count repetidos 2",countRepetidos);// value undefined
>
> log :
>
> 3|wscontro | count repetidos 1 1163|wscontro | count repetidos 2 undefined
>
> I try instead of use resolve, use callback but nothing... I saw other 
> answers in javascript but for node.js I cant resolve this problem... I saw 
> the link refering thus question as a duplicate but cant figure out a 
> solution to this case.
>

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/bff3ffb3-40e5-4d86-97fa-61e7e7536df1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] outside for loop var value is undefined

2017-07-24 Thread DaneiL
You have to put this line

console.log("count repetidos 2",countRepetidos);// value undefined

before the return function

return resolve(countRepetidos);

var countRepetidos;if(obj.data.list!={} && obj.data.list.length>0){
var aux = obj.data["list"];
countRepetidos=0;
for(var i=0;i0){
   countRepetidos++;
   console.log("count repetidos 1",countRepetidos); // value 116
}
});
}
console.log("count repetidos 2",countRepetidos);
return resolve(countRepetidos);}


On 21 July 2017 at 08:54, Catia Matos  wrote:

>
> 0down votefavorite
> 
>
> I'm facing a problem with a value where inside my for cycle it has values
> like "179" and outside i get always undefined. Why?
>
> var countRepetidos;if(obj.data.list!={} && obj.data.list.length>0){
> var aux = obj.data["list"];
> countRepetidos=0;
> for(var i=0;iDatabase.Probing.getMacAdress(aux[i]).then(function(data){
> if(data.count>0){
>countRepetidos++;
>console.log("count repetidos 1",countRepetidos); // value 116
> }
> });
> }
> return resolve(countRepetidos);}
>
> console.log("count repetidos 2",countRepetidos);// value undefined
>
> log :
>
> 3|wscontro | count repetidos 1 1163|wscontro | count repetidos 2 undefined
>
> I try instead of use resolve, use callback but nothing... I saw other
> answers in javascript but for node.js I cant resolve this problem... I saw
> the link refering thus question as a duplicate but cant figure out a
> solution to this case.
>
> --
> 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 nodejs+unsubscr...@googlegroups.com.
> To post to this group, send email to nodejs@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/nodejs/743beb4c-731e-4d2c-8055-bdf1804c4595%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
[]'s

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAET7tnaA912n2_UgKGmS9dxAtsbfOgfxzgaDPMegazHiYeXkCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[nodejs] Keeping a readable stream open if source fails

2017-07-24 Thread Damon Black
Hi,

I'm trying to record an audio stream to a local file, so readable to 
writable stream, no problem. However if the audio source dies i want to 
keep the file (ws) from closing it can simply append data to the existing 
file.

Everything i've tried (new readable, request, fetch, fluent-ffmpeg) 
immediately kills the script when the source stream fails. I've tried {end: 
false} on the writable but i think it's the readable that dies.

So is there away to keep a readable stream open if its source fails?

Thanks
D

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/dfafd1fb-1b77-4242-b9e9-a9f1209b3339%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [nodejs] outside for loop var value is undefined

2017-07-24 Thread tpx1
Hi,

to mentions for you problem. Do it like this:

let countRepetidos = 0;
const count = (data) => {
if(data.count>0){
countRepetidos++;
console.log("count repetidos 1",countRepetidos); // value 116
}
};

Promise.all(aux.map((val) =>
Database.Probing.getMacAdress(val).then(count)).then(() =>
resolve(countRepetidos))

Your problem is a classical async problem. You mix async and sync stuff.
What we do is, to map your aux values to the resolver values from the
query. Now we are able to watch, if all resolver are are finished by
Promise.all and then handle your counting.

A much fancier implementation is this.

const count = (data) => {
return data.count > 0 ? 1 : 0;
};

Promise.all(aux.map((val) =>
Database.Probing.getMacAdress(val).then(count)).then((data) =>
resolve(data.reduce((p,c) => p+c,1));

You also should use Array.isArray(obj.data.list) instead of this -
obj.data.list!={} - in the if statement.

Hope it will help to solve your problem.

Thomas


Am 21.07.2017 um 13:54 schrieb Catia Matos:
> 
> 0down votefavorite
> 
>   
> 
> I'm facing a problem with a value where inside my for cycle it has
> values like "179" and outside i get always undefined. Why?
> 
> |varcountRepetidos;if(obj.data.list!={}&>0){varaux
> =obj.data["list"];countRepetidos=0;for(vari=0;i0){countRepetidos++;console.log("count
> repetidos 1",countRepetidos);// value
> 116}});}returnresolve(countRepetidos);}console.log("count repetidos
> 2",countRepetidos);// value undefined|
> 
> log :
> 
> |3|wscontro |count repetidos 11163|wscontro |count repetidos 2undefined|
> 
> I try instead of use resolve, use callback but nothing... I saw other
> answers in javascript but for node.js I cant resolve this problem... I
> saw the link refering thus question as a duplicate but cant figure out a
> solution to this case.
> 
> -- 
> 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 nodejs+unsubscr...@googlegroups.com
> .
> To post to this group, send email to nodejs@googlegroups.com
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/743beb4c-731e-4d2c-8055-bdf1804c4595%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/2d63bc84-5124-ca9c-7b8f-654f68c8041e%40gmx.de.
For more options, visit https://groups.google.com/d/optout.