Os.File.setPermission is not recognized as a function

I have this (partial) main JS code:

Cu.import("resource://gre/modules/osfile.jsm");
[...]
// if it is a Win environment put the attrib file to hidden
OS.File.setPermission(
        OS.Path.join(OS.Constants.Path.homeDir,  'my_file.txt'),
            {
                winAttributes: {
                    hidden: true
                }
            }
).then(x => console.log('success',x), y => console.log('failure',y));

I am testing it on Linux, and when the execution reaches the promise indicated above, it is reported this error:

console.log: TypeError: OS.File.setPermission is not a function

I suppose this effect also indicates that the execution of that part on an add-on target Windows platform is compromised, isn’t it?

Why does it happen? Where am I wrong? Thanks.

It’s OS.File.setPermissions (plural).

Thank you very much, I had just noticed this fact :slight_smile: