jprichardson / node-jsonfile

Easily read/write JSON files.
MIT License
1.2k stars 321 forks source link

Linux: Hidden file not working #41

Closed maxime1992 closed 8 years ago

maxime1992 commented 8 years ago

I would like to read an hidden file (starting with a dot).

When I display err I have this : [SyntaxError: ./.gitcommitsummary: Unexpected token t].

Here's the code I tried :

jsonfile.readFile('./.gitcommitsummary', (err, obj) => {
    console.log(err);
    if (err) {
        console.log('Create a file called ".gitcommitsummary" at the root of your project to use git-commit-summary.');
        return;
    }

    console.log(obj);
});

Am I missing something ?

maxime1992 commented 8 years ago

Sorry I just found out what was wrong !

It's not the hidden file but my json file was not ok. (I tried to have the keys without quote, then simple quote but I didn't try double quote).

Now it's working with double quote !