Loading ...
Sorry, an error occurred while loading the content.

Re: Allowing octal literals

Expand Messages
  • Douglas Crockford
    ... No. Try this: fs.mkdir(dirname, parseInt( 755 , 8), callback); Octal is really hazardous, and it is rarely useful. For those rare useful cases, it is worth
    Message 1 of 2 , Feb 26, 2011
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Martin Cooper <mfncooper@...> wrote:
      >
      > 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?

      No. Try this:

      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.
    Your message has been successfully submitted and would be delivered to recipients shortly.