You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't believe this is a bug. If imported text is a string with the content as is. When you pass the text as is to console.log it will interpret the \n as such. What you may be wanting is to escape newlines before passing it to console.log. Something like console.log(text.replaceAll("\n", "\\n")).
Hi @jdalton , the problem is not with console.log. The text file should be read as "printf(\"Hello, world\\n\");", but Bun instead changed the \n to a newline character.
I believe a file reading operation should treat the file's content as is. The 2 snippets below should produce the same result:
What version of Bun is running?
1.0.33+9e91e137f
What platform is your computer?
Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
text.txt:
index.ts:
bun run index.ts
What is the expected behavior?
The following should be printed to the console:
What do you see instead?
Additional information
txt files should be loaded as is.
The text was updated successfully, but these errors were encountered: