copy-file-content
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

copy-file-content

Latest Stable Version Total Downloads

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

Name Type Required Default
--encoding BufferEncoding false utf-8

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

Package Sidebar

Install

npm i copy-file-content

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.69 kB

Total Files

8

Last publish

Collaborators

  • stlmpp