Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Storing some data with nodejs?

Storing some data with nodejs?


I'm writing a Lastfm plugin for a chat bot my friend wrote, and one of the things I'd like to is allow people to register their hostmask/nick with their lastfm username (something like !reg lastfmuser would store that username with the hostmask/nick for whoever said it). The framework and plugins are written in javascript/nodejs. I'm not sure where to start at all on storing/accessing this data on the disk or however it would be done.

Basically, I want to have a file that it can look through when someone calls a lastfm command (nowplaying, compare, topartists) and it'll use the stored username instead of their nick if possible. So the file would be something like:

Hostname | Nick | Lastfmuser

I've never written something that stores data on the disk, or has to read from the disk, and I'm still fairly new to nodejs/javascript. I looked at alfred.js, but ended up confused and not sure if that's what I really wanted.

Problem courtesy of: Rob


If you insist :)

When a person wants to store some data to be read/manipulated later, he should use database in most cases. There are cases when files are more preferable, but this is not one of them.

Schemaless database (like MongoDB) is a good fit here, because it allows faster prototyping and development (as opposed to relational databases with fixed schema).

Solution courtesy of: Sergio Tulentsev


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Storing some data with nodejs?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription