# @yunser/share-cli

> Share text and files on a local area network.

Latest version **21.5.0** (published 2022-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @yunser/share-cli
pnpm add @yunser/share-cli
yarn add @yunser/share-cli
bun add @yunser/share-cli
```

Provides the command `share`.

## Health

**Score 5/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score; declining downloads.

## Facts

| | |
|---|---|
| Version | 21.5.0 |
| Published | 2022-07-24 |
| First published | 2021-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 913.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yunser |
| Maintainers | yunser-admin |

## Links

- npm: https://www.npmjs.com/package/@yunser/share-cli
- Repository: https://github.com/yunser/share-cli
- Homepage: https://github.com/yunser/share-cli#readme
- Issues: https://github.com/yunser/share-cli/issues
- npm.io page: https://npm.io/package/@yunser/share-cli

## Dependencies (12)

- [koa](https://npm.io/package/koa.md) ^2.13.1
- [open](https://npm.io/package/open.md) ^8.0.2
- [koa-body](https://npm.io/package/koa-body.md) ^4.2.0
- [commander](https://npm.io/package/commander.md) ^7.1.0
- [public-ip](https://npm.io/package/public-ip.md) ^4.0.3
- [copy-paste](https://npm.io/package/copy-paste.md) ^1.3.0
- [koa-router](https://npm.io/package/koa-router.md) ^10.0.0
- [koa-server](https://npm.io/package/koa-server.md) ^1.2.2
- [koa-static](https://npm.io/package/koa-static.md) ^5.0.0
- [portfinder](https://npm.io/package/portfinder.md) ^1.0.28
- [serve-handler](https://npm.io/package/serve-handler.md) ^6.1.3
- [qrcode-terminal](https://npm.io/package/qrcode-terminal.md) ^0.12.0

## Recent versions

- 21.5.0 (latest) — 2022-07-24
- 21.4.13 — 2021-04-12
- 21.4.13-beta.0 — 2021-04-12
- 21.4.12 — 2021-04-12
- 21.4.1 — 2021-04-09
- 21.4.0 — 2021-04-09
- 21.0.0 — 2021-04-09
- 0.0.2 — 2021-03-12
- 0.0.1 — 2021-03-11

## README

share-cli

# What

A command tool to share files on a local area network.

一个局域网文件分享小工具。


# Install

```
npm i @yunser/share-cli -g
```


# Usage

Share all files in a folder.

```
share in <path>
```

example:

```
cd share_local
share in .
```

PC 发送文本到手机：

```
share text xxx
```

然后手机使用浏览器扫码。

手机发送文本到 PC：

```
share server
```

然后手机使用浏览器扫码打开网页，然后输入文本，提交。提交的文本会在控制台打印出来。


# TODO

* 手机发送文本到电脑


# 更新日志

* 21.5.0
    * 修复文本文件无法直接下载的问题
* 21.4.12
    * 支持移动端向 PC 发送文本和文件。
* 21.4.12
    * 修复 bugs


# 文档地址

* https://yunser.gitee.io/share-cli/


# 公众号文章介绍

[局域网文件分享小工具](https://mp.weixin.qq.com/s/179PB5V2FN9B1gE7_ugMPA)

这几天在搞 app 开发，经常需要向多台移动设备传输文件。

以前一直用微信或 QQ 来传输文件，尽管很不好用，但也能将就。这次用得很不爽，一是没有那么多的微信账号，二是同个文件需要多次发送到不同手机。

于是花了半个小时写了个命令行工具，可以用于局域网内 PC 向移动设备快速传输文件。

这是一个基于 Node.js 的小工具，可以使用 npm 快速安装。

```
npm i @yunser/share-cli -g
```

安装后，在任意要分享的目录使用 `share` 命令来创建静态文件服务。

```
cd share_local
share in .
```

![](http://webcdn.yunser.com/@share-cli/share-1.png)

执行命令后，用手机扫码控制台打印的二维码，即可查看、下载文件。

也可以在其他电脑打开网址，查看文件。

我们也可以使用这个小工具来传输文本到手机：

```
share text hello
```

功能挺简单的，也很实用。有需要可以尝试一下。

---
_Source: https://npm.io/package/@yunser/share-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
