Skip to content

Instantly share code, notes, and snippets.

@ikku47
Created November 16, 2022 12:12
Show Gist options
  • Save ikku47/409f6a2db25abee6de885e14e09e7d31 to your computer and use it in GitHub Desktop.
Save ikku47/409f6a2db25abee6de885e14e09e7d31 to your computer and use it in GitHub Desktop.
Bun code for printing the contents of a file
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