Skip to content

Commit

Permalink
Merge pull request #4 from celsodias12/dev
Browse files Browse the repository at this point in the history
feat: add buffer encoding variable
  • Loading branch information
celsodias12 authored Apr 17, 2022
2 parents d93c30d + 533d509 commit 6a6b77d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ const fileName = process.argv?.[2] || '.env'

const envPath = path.join(process.cwd(), fileName)

const bufferEncoding = 'utf8'

if (fs.existsSync(envPath)) {
fs.readFile(envPath, 'utf8', (errorRead, fileData) => {
fs.readFile(envPath, bufferEncoding, (errorRead, fileData) => {
if (errorRead) {
console.log(errorRead)

Expand All @@ -22,7 +24,7 @@ if (fs.existsSync(envPath)) {
fs.writeFile(
path.join(process.cwd(), '.env.example'),
result,
'utf8',
bufferEncoding,
errorWrite => {
if (errorWrite) {
console.log(errorWrite)
Expand Down

0 comments on commit 6a6b77d

Please sign in to comment.