On May 26, 2014, at 1:19 PM, Nik Sumeiko <[email protected]> wrote:

> With `require` you get the JSON object; With `fs.readFileSync` you get a 
> string that have to be parsed using `JSON.parse`.
> 
> So `var pkg = require(__dirname + '/package.json')` is much shorter than `var 
> pkg = JSON.parse(fs.readFileSync(__dirname + '/package.json'))`, especially 
> when you cannot use `fs` module without loading it before with `var fs = 
> require('fs')`

And more saliently, require() resolves paths differently, and in this case, I 
think with behavior that’s wanted.

Aria

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to