21.5.0 • Published 2 years ago

@yunser/share-cli v21.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

文档地址

公众号文章介绍

局域网文件分享小工具

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

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

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

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

npm i @yunser/share-cli -g

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

cd share_local
share in .

npm.io

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

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

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

share text hello

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