Skip to content

Conversation

SvanBoxel
Copy link
Contributor

@SvanBoxel SvanBoxel commented Nov 6, 2020

readFileSync returns a raw buffer if no encoding format is specified. An empty markdown file will for that reason still be truthy and be posted as a comment.

Example (a.md is an empty file):

Screenshot 2020-11-06 at 09 42 52
> const checkIfFalsy = (value) => value ? console.log('is not falsy') : console.log('is falsy')
undefined
> test = readFileSync('./a.md')
<Buffer >
> checkIfFalsy(test)
is not falsy
undefined
> test = readFileSync('./a.md', 'utf-8')
''
> checkIfFalsy(test)
is falsy

@marocchino marocchino merged commit 9740b9a into marocchino:master Nov 9, 2020
@github-actions
Copy link

github-actions bot commented Nov 9, 2020

Test 9740b9a is successfully ended.
This is message from push.

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.

2 participants