add error data and comeplete fs.writefile