Re: Allowing octal literals
- --- In firstname.lastname@example.org, Martin Cooper <mfncooper@...> wrote:
>No. Try this:
> Working with Node.js (and probably other SSJS solutions), it's pretty
> common to find yourself working with the file system and using file
> permissions the natural way, in octal. Something like this:
> fs.mkdir(dirname, 0755, callback);
> However, JSLint complains about "Unexpected '0755'", presumably
> because it doesn't like octal.
> I've looked for a way to turn off complaints about this, but don't see
> one. Am I missing it?
fs.mkdir(dirname, parseInt('755', 8), callback);
Octal is really hazardous, and it is rarely useful. For those rare useful cases, it is worth it to work a little harder.