Le jeudi 23 mai 2013 19:32:25 UTC+2, Domenic Denicola a écrit :

>  That's overstating it a bit. It's very easy to convert to promise-based 
> code, e.g.:
>
> var fs = require('fs');
> var Q = require('q');
>
> var readFile = Q.denodeify(fs.readFile);
> var writeFile = Q.denodeify(fs.writeFile);
>
> readFile('src.txt').then(function (result) { writeFile('dest.txt', 
> result); }).done();
>
> Since this conversion process is pretty mechanical, there are several 
> libraries that have done it for you, e.g. https://npmjs.org/package/pr
>

A different approach:

  var read = Parole(); readFile( "dest.txt", "utf8", read );
  read.then( function( r ){....} );
 
Parole() is an "npm l8" subset. See https://github.com/JeanHuguesRobert/l8

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to