Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.appendFileSync does not accept a number type in data argument node v14 #33213

Closed
ykhedher opened this issue May 2, 2020 · 3 comments
Closed
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@ykhedher
Copy link

ykhedher commented May 2, 2020

  • Version: 14.1.0
  • Platform: Windows 10
  • Subsystem: none
  • error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (7)

this is the code:

const fs = require('fs')

fs.writeFileSync('notes.txt', 'NODEJS')


fs.appendFileSync('notes.txt', 7 )

I expected to get a file with: NODEJS7
I got : NODEJS

@mscdex
Copy link
Contributor

mscdex commented May 2, 2020

Seems like the correct behavior to me. Are you saying this worked in a previous version?

@devsnek
Copy link
Member

devsnek commented May 2, 2020

This isn't a bug, the validation was tightened up. See #31030.

@devsnek devsnek closed this as completed May 2, 2020
@devsnek devsnek added the fs Issues and PRs related to the fs subsystem / file system. label May 2, 2020
@ykhedher
Copy link
Author

ykhedher commented May 6, 2020

Seems like the correct behavior to me. Are you saying this worked in a previous version?

YES actually I created a NODE COURSE, I was using node v13 but some students using node v14 got this issue so upgraded node and I got the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

3 participants