fs: Support mode/flag options to read/append/writeFile

Fix #4841