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

fix: correct writefile bug when choosing multiple languages #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant