Created
April 15, 2012 20:29
-
-
Save glennblock/2394695 to your computer and use it in GitHub Desktop.
async exits with streamline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this does not work because exists does not accept a standard callback | |
function createRequiredFilesIfNotPresent(_) { | |
var baseFolder = process.cwd(); | |
var exists = path.exists(baseFolder + "/server.js"); | |
log.info(exists); | |
} | |
//using a wrapper function however works. Log entries added for sequence. | |
function exists(p, callback) { | |
path.exists(p, function(e) { | |
callback(null, e); | |
}); | |
} | |
function createRequiredFilesIfNotPresent(_) { | |
var baseFolder = process.cwd(); | |
log.info("check exists start"); | |
var p1 = exists(baseFolder + "/server.js", _); | |
log.info("exists:" + p1); | |
log.info("check exists complete"); | |
} |
good point. Then a small add-on maybe of common streamline helpers would be
very cool.
…On Mon, Apr 16, 2012 at 1:07 PM, Bruno Jouhier < ***@***.*** > wrote:
Yes, I could provide a small library with it, or at least document it. I
want to write a FAQ but I keep getting dragged into other things, like blog
articles.
I don't want to put it directly into streamline's runtime though because I
want to keep streamline at the language level. It runs in the browser too.
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2394695
Yes.
I have bundled a helper for streams because streams have an event API that does not work too well with streamline. So I have introduced a callback API on top of it that works much better with streamline. I did it because this is a non trivial thing and it makes a big difference in usability.
But I did not take care of all the corner cases of the node API. I could introduce a nodeutils
module with other wrappers. I'll do it when I get time.
I track all this through the GitHub issues system. So if you want to enter the suggestion there please do it. Otherwise, I'll do it.
Bruno
I'd be happy to do a PR if you have a repo :-)
…On Tue, Apr 17, 2012 at 4:28 AM, Bruno Jouhier < ***@***.*** > wrote:
Yes.
I have bundled a helper for streams because streams have an _event_ API
that does not work too well with streamline. So I have introduced a
_callback_ API on top of it that works much better with streamline. I did
it because this is a non trivial thing and it makes a big difference in
usability.
But I did not take care of all the corner cases of the node API. I could
introduce a `nodeutils` module with other wrappers. I'll do it when I get
time.
I track all this through the GitHub issues system. So if you want to enter
the suggestion there please do it. Otherwise, I'll do it.
Bruno
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2394695
It's https://github.com/Sage/streamlinejs
Just file an "issue". I like to have things filed here because I like
"closing" issues, and this one should be an easy one :-)
BTW, I work for Sage, we compete in the business apps sphere but we also
partner with MS at many levels.
Bruno
2012/4/17 Glenn Block <
[email protected]
… I'd be happy to do a PR if you have a repo :-)
On Tue, Apr 17, 2012 at 4:28 AM, Bruno Jouhier <
***@***.***
> wrote:
>
> Yes.
>
> I have bundled a helper for streams because streams have an _event_ API
> that does not work too well with streamline. So I have introduced a
> _callback_ API on top of it that works much better with streamline. I did
> it because this is a non trivial thing and it makes a big difference in
> usability.
>
> But I did not take care of all the corner cases of the node API. I could
> introduce a `nodeutils` module with other wrappers. I'll do it when I get
> time.
>
> I track all this through the GitHub issues system. So if you want to
> enter
> the suggestion there please do it. Otherwise, I'll do it.
>
> Bruno
> ---
>
> Reply to this email directly or view it on GitHub:
> https://gist.github.com/2394695
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2394695
great. We should do a Skype chat :-) We're using streamline btw on a module
we are developing.
On Tue, Apr 17, 2012 at 1:16 PM, Bruno Jouhier <
[email protected]
… wrote:
It's https://github.com/Sage/streamlinejs
Just file an "issue". I like to have things filed here because I like
"closing" issues, and this one should be an easy one :-)
BTW, I work for Sage, we compete in the business apps sphere but we also
partner with MS at many levels.
Bruno
2012/4/17 Glenn Block <
***@***.***
> I'd be happy to do a PR if you have a repo :-)
>
> On Tue, Apr 17, 2012 at 4:28 AM, Bruno Jouhier <
> ***@***.***
>
> > wrote:
> >
> > Yes.
> >
> > I have bundled a helper for streams because streams have an _event_ API
> > that does not work too well with streamline. So I have introduced a
> > _callback_ API on top of it that works much better with streamline. I
> > did
> > it because this is a non trivial thing and it makes a big difference in
> > usability.
> >
> > But I did not take care of all the corner cases of the node API. I
> > could
> > introduce a `nodeutils` module with other wrappers. I'll do it when I
> > get
> > time.
> >
> > I track all this through the GitHub issues system. So if you want to
> > enter
> > the suggestion there please do it. Otherwise, I'll do it.
> >
> > Bruno
> > ---
> >
> > Reply to this email directly or view it on GitHub:
> > https://gist.github.com/2394695
> ---
>
> Reply to this email directly or view it on GitHub:
> https://gist.github.com/2394695
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2394695
Sure. My skype is offline most of the time but I'll turn it on. But that won't be before tomorrow as I'm travelling today.
Forgot. my skype id is bjouhier
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, I could provide a small library with it, or at least document it. I want to write a FAQ but I keep getting dragged into other things, like blog articles.
I don't want to put it directly into streamline's runtime though because I want to keep streamline at the language level. It runs in the browser too.