fs: make writeFileSync/appendFileSync correctly set file mode

i Please enter the commit message for your changes. Lines starting