Skip to content

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

Closed
@ykhedher

Description

@ykhedher
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions