Created
November 16, 2022 12:12
-
-
Save ikku47/409f6a2db25abee6de885e14e09e7d31 to your computer and use it in GitHub Desktop.
Bun code for printing the contents of a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {resolve} from 'path'; | |
import {write, stdout, file, argv} from 'bun'; | |
const path = resolve(argv.at(-1)); | |
await write( | |
// stdout is a Blob | |
stdout, | |
// file(path) returns a Blob - https://developer.mozilla.org/en-US/docs/Web/API/Blob | |
file(path) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment