copy-file-content

Very simple package to copy the file content to your clipboard
Motivation
I was tired of opening text files to copy their content, so I created this package.
Usage
There's 2 ways of using
Using the package globally as a command tool
First install the package globally
pnpm add copy-file-content -g
Then you can use it to the file content
copy-file-content file.html
After this, the file content will be avaiable in the clipboard
Using the package as a dependency
Add the package as a dependency
pnpm add copy-file-content
Then import the function and use it
import { copyFileContent } from 'copy-file-content';
await copyFileContent('file.html');
After this, the file content will be avaiable in the clipboard
Arguments
You can also use the arguments as options in the second argument of the exported function copyFileContent, like this:
import { copyFileContent } from 'copy-file-content';
await copyFileContent('file.html', { encoding: 'utf-16' });
Requirements
Node.js version 16 or superior
Notes
- This package only works in a Node.js environments, it was not tested in the browser
- This package is ESM only, it was not tested with CommonJS
- This package only works with text files. It will not copy the content of a .xlsx, for example
- This package does not validate how big the file is, I made it to be used with small files