Skip to content

Conversation

@AlextheYounga
Copy link

@AlextheYounga AlextheYounga commented Dec 8, 2022

This change corrects an error generated from selecting multiple languages, where it would pass an array into the writeFile command. Now all data passed to writeFile is converted into a string. This is a very small correction, where I just add .toString() to the data being passed to writeFile()

Error encountered

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Array
    at writeFile (node:fs:2168:5)
    at node:internal/util:364:7
    at new Promise (<anonymous>)
    at writeFile (node:internal/util:350:12)
    at writeFile (/Users/alexyounger/.config/yarn/global/node_modules/gitignore-it/file_utils.js:37:9)
    at /Users/alexyounger/.config/yarn/global/node_modules/gitignore-it/index.js:44:9 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Solution

await writeFile('.gitignore', gitignoreContent.toString())

This change corrects an error generated from selecting multiple
languages, where it would pass an array into the writeFile command.
Now all data passed to writeFile is converted into a string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant