{"id":18484136,"url":"https://github.com/jdf2e/client-upload","last_synced_at":"2025-10-16T03:36:32.594Z","repository":{"id":57132425,"uuid":"156839658","full_name":"jdf2e/client-upload","owner":"jdf2e","description":"use http or sftp to upload locale files","archived":false,"fork":false,"pushed_at":"2018-11-09T10:52:51.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-23T17:12:55.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdf2e.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-09T09:28:26.000Z","updated_at":"2020-11-18T08:45:58.000Z","dependencies_parsed_at":"2022-09-01T00:11:43.703Z","dependency_job_id":null,"html_url":"https://github.com/jdf2e/client-upload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdf2e%2Fclient-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdf2e%2Fclient-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdf2e%2Fclient-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdf2e%2Fclient-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdf2e","download_url":"https://codeload.github.com/jdf2e/client-upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247902731,"owners_count":21015506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T12:38:40.992Z","updated_at":"2025-10-16T03:36:27.556Z","avatar_url":"https://github.com/jdf2e.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### @nutui/upload\n---\n可以非常方便的使用该模块同步本地文件到服务器，支持`http`与`sftp`两种上传方式，\n推荐首选`sftp`上传：\n* 在`Linux`里开启`ssh`就默认启用了`sftp`，一般不需要单独配置\n* `sftp`会加密传输认证信息和数据，相对来说更安全\n* 注意服务器里目录的权限问题\n\n### 安装\n---\n```js\nnpm i -D @nutui/upload\n```\n\n### 配置使用\n---\n```js\nconst ClientUpload = require('@nutui/upload');\n\nClientUpload({\n  source: 'src',\n  ignoreRegexp: /node_modules/,\n  success: function() {},\n  sftpOption: {\n    host: '0.0.0.0',\n    port: 1234,\n    username: 'user',\n    password: 'user',\n    target: '/home'\n  }\n});\n```\n\n### 支持 webpack\n---\n\n```js\nconst WebpackUploadPlugin = require('@nutui/upload/webpackUploadPlugin');\n\n// webpack.config.js\n// 相关配置同上\n{\n  plugins: [\n    ...\n    new WebpackUploadPlugin(options)\n  ]\n}\n```\n\n### 支持命令行操作（nut）\n---\n通过命令来上传文件到服务器，仅支持`sftp`\n```js\nnpm i -g @nutui/upload\n\nnut upload \u003coption\u003e\n```\n* **-s --source** 待上传的文件目录\n* **-i --ignore** 忽略的目录\n* **-r --remote** 接收文件的服务器相关配置 `user:pass@ip:port/target`\n\n### 参数说明\n---\n| 属性 | 说明 | 默认值 | 是否必填\n|----- | ----- | ----- | -----\n| source | 待上传的文件目录 | - | 是\n| ignoreRegexp | 忽略文件的匹配模式 | - | 否\n| success | 上传成功的回调 | - | 否\n| sftpOption.host | 服务器地址 | - | 是\n| sftpOption.port | 服务器端口 | 22 | 否\n| sftpOption.username | 用户名 | - | 是\n| sftpOption.password | 密码 | - | 是\n| sftpOption.target | 接收文件的目录 | - | 是\n| httpOption[option] | 参考 sftpOption | - | 是","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdf2e%2Fclient-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdf2e%2Fclient-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdf2e%2Fclient-upload/lists"}