guy mograbi guy mograbi - 2 months ago 36
Node.js Question

how to avoid "Octal literals are not allowed in strict mode" with createWriteStream

I have the following code

fs.createWriteStream( fileName, {
flags : 'a',
encoding : 'utf8',
mode : 0644
});


I get a lint error

Octal literals are not allowed in strict mode.


What is the correct way to do this code so I won't get a lint error?

Answer

I don't have a node installation at hand, but looking at sources it seems that they allow strings as well:

  mode     : '0644'

Does it work?