npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rsh-ws

v2.1.2

Published

远程外壳,使用WebSocket连接

Downloads

3

Readme

Remote Shell - WebSocket

rsh-ws


协议:MIT


怎么使用?

  1. 首先,全局安装此项目,运行npm i rsh-ws -g
  2. 使用rsh-ws来启动服务
  3. 服务会在终端打印连接代码,例如0O0P5D99,前4位是端口号码,后4位是连接密码,端口号码请使用36进制解析,在这个例子中,端口号码是31129
  4. 使用WebSocket连接ws://ip:31129,如果是本机,ip可以为127.9.9.9
  5. 执行命令,例如,在本例子中,连接密码是5D99,你可以发送JSON命令
{
    "do": "login",
    "passwd": "5D99"
}

来登录

  1. 创建终端
{
    "do": "createTerminal",
    "cwd": "./", //终端目录
}

返回值中有 data.pid 参数,用来标识终端 7. 发送命令

{
    "pid": "<pid>",
    "do": "write-to-terminal",
    "data": "ls"
}

这会向终端的stdin写入data 8. 返回命令结果
格式为

{
    "status": "ok",
    "data": {
        "type": "Received data",
        "data": "<data here>"
    }
}
  1. 获得rsh-ws版本
    发送命令
{
    "do": "get-version"
}

返回结果

{
    "status": "ok",
    "data": {
        "type":"version",
        "version": "<version here>"
    }
}
  1. 文件处理
    发送命令
{
    "do": "file-operation",
    "path": "<path here>"
}

将会返回

{
    "status": "ok",
    "data": {
        "port": "<port here>",
        "file_id": "<file_id here>",
        "path": "<path here>"
    }
}

文件传输使用HTTP协议
支持以下方法

  • GET http://ip:port/<file_id> 下载文件,响应数据为文件内容
  • PUT http://ip:port/<file_id> 上传文件,Body负载为文件内容
  • DELETE http://ip:port/<file_id> 删除文件

port请使用返回数据中的port