During testing I comment out creating the file and just try reading it. Is the JSON.parse async?
Does it have a callback function?

This only gives you the key/value pairs while its parsing
JSON.parse(function (k,v){});


Roly Fentanes <mailto:roly...@gmail.com>
Sunday, April 01, 2012 6:17 PM
I don't see a callback on your `writeFile`. are you sure there's no race condition?

On Sunday, April 1, 2012 1:25:29 PM UTC-7, Matthew Hazlett wrote: --
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
Matthew Hazlett <mailto:hazl...@gmail.com>
Sunday, April 01, 2012 4:25 PM
This throws an error unexpected end of file.

        fs.readFile(__dirname + '/' + filename, function (err, data) {
                if (err) throw err;
                console.log(data);
        });

This is a oneline file created by:

        fs.writeFile(__dirname + '/' + filename, JSON.stringify(data));

The file exists and the permissions are fine. Whats wrong?

--
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--

*Matthew Hazlett*/Owner//, Clarity Computers/
Tel: 603 707 1774| Mobile: 603 707 1774
hazl...@gmail.com| http://www.linkedin.com/in/hazlema


Facebook <http://www.facebook.com/profile.php?id=1491561960> Twitter <https://twitter.com/#%21/hazlema> LinkedIn <http://www.linkedin.com/in/hazlema>

--
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

<<inline: postbox-contact.jpg>>

<<inline: postbox-contact.jpg>>

<<inline: facebook.png>>

<<inline: twitter.png>>

<<inline: linkedin.png>>

Reply via email to