{"id":15357198,"url":"https://github.com/gera2ld/qiniu-uploader","last_synced_at":"2025-07-03T23:38:26.612Z","repository":{"id":57332232,"uuid":"71345114","full_name":"gera2ld/qiniu-uploader","owner":"gera2ld","description":"A command tool to upload files to qiniu","archived":false,"fork":false,"pushed_at":"2016-12-23T08:02:51.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T09:26:01.364Z","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/gera2ld.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":"2016-10-19T10:17:40.000Z","updated_at":"2016-12-12T11:15:03.000Z","dependencies_parsed_at":"2022-09-15T12:31:24.308Z","dependency_job_id":null,"html_url":"https://github.com/gera2ld/qiniu-uploader","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fqiniu-uploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fqiniu-uploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fqiniu-uploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gera2ld%2Fqiniu-uploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gera2ld","download_url":"https://codeload.github.com/gera2ld/qiniu-uploader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241913788,"owners_count":20041459,"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-10-01T12:33:56.217Z","updated_at":"2025-03-04T19:46:11.422Z","avatar_url":"https://github.com/gera2ld.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"qiniu-uploader\n===\n\n![NPM](https://img.shields.io/npm/v/qiniu-uploader.svg)\n![License](https://img.shields.io/npm/l/qiniu-uploader.svg)\n![Downloads](https://img.shields.io/npm/dt/qiniu-uploader.svg)\n\nA command tool to upload files to qiniu\n\nInstallation\n---\n\n```sh\n$ npm i qiniu-uploader -g\n```\n\nUsage\n---\n\n```\nusage: qiniu-upload [-h] [-v] [-n] [-b BUCKET] [--base BASE] [-p PREFIX]\n                    [--verbose] [--ak AK] [--sk SK]\n                    patterns [patterns ...]\n\nUpload files to qiniu\n\nPositional arguments:\n  patterns              Set glob pattern to filter files\n\nOptional arguments:\n  -h, --help            Show this help message and exit.\n  -v, --version         Show program's version number and exit.\n  -n, --dry             List the files to be uploaded and exit\n  -b BUCKET, --bucket BUCKET\n                        Set qiniu bucket\n  --base BASE           Set base path, default as current working directory\n  -p PREFIX, --prefix PREFIX\n                        Set prefix for the remote link\n  --verbose             Show details during uploading\n  --ak AK               Set qiniu access key, default as `process.env.\n                        QINIU_ACCESS_KEY`\n  --sk SK               Set qiniu secret key, default as `process.env.\n                        QINIU_SECRET_KEY`\n```\n\n* `patterns` will be parsed by [node-glob](https://github.com/isaacs/node-glob).\n* `--bucket` and `AK`/`SK` are required if `--dry` is not assigned.\n\nProgrammatic APIs\n---\n``` js\nconst uploadAll = require('qiniu-uploader');\n\nuploadAll({\n  bucket: 'my-bucket',\n  patterns: [\n    'dist/**',\n  ],\n})\n.then(items =\u003e {\n  console.log('Uploaded items:', items);\n});\n\nuploadAll.upload('my-bucket', {\n  type: 'raw',\n  key: 'key-to-file.txt',\n  data: 'hello, world',\n})\n.then(() =\u003e {\n  console.log('Uploaded raw text.');\n});\n\n// get puttoken for further use\nconst putToken = uploadAll.putToken('my-bucket', {\n  expires: 100,\n  saveKey: 'prefix/$(etag)',\n  returnBody: JSON.stringify({path: 'prefix/$(etag)'}),\n});\n\n// parse keys after booted\nuploadAll.parser.parseKeys({\n  ak: 'QINIU_ACCESS_KEY',\n  sk: 'QINIU_SECRET_KEY',\n});\n```\n\nExamples\n---\nAssume we have a file system is like this:\n```\n▸ .git/\n▾ dist/\n    app.css\n    app.js\n    index.html\n```\n\nUpload all files in `dist/`:\n``` sh\n$ qiniu-upload --base dist --bucket my-bucket --verbose 'dist/**'\n```\n\nUpload all `.js` and `.css` files in `dist/`:\n``` sh\n$ qiniu-upload --base dist --bucket my-bucket --verbose 'dist/**.@(js|css)'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgera2ld%2Fqiniu-uploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgera2ld%2Fqiniu-uploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgera2ld%2Fqiniu-uploader/lists"}