{"id":16434502,"url":"https://github.com/zce/qiniu-store","last_synced_at":"2025-03-21T04:33:00.335Z","repository":{"id":33156336,"uuid":"153236991","full_name":"zce/qiniu-store","owner":"zce","description":"Qiniu Storage for Ghost","archived":false,"fork":false,"pushed_at":"2023-06-17T19:24:25.000Z","size":221,"stargazers_count":7,"open_issues_count":25,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T08:49:23.614Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-16T06:54:52.000Z","updated_at":"2023-03-08T04:01:22.000Z","dependencies_parsed_at":"2023-01-14T23:42:57.508Z","dependency_job_id":null,"html_url":"https://github.com/zce/qiniu-store","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/zce%2Fqiniu-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fqiniu-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fqiniu-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fqiniu-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zce","download_url":"https://codeload.github.com/zce/qiniu-store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811540,"owners_count":16884362,"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-11T08:49:19.682Z","updated_at":"2024-10-28T09:25:32.575Z","avatar_url":"https://github.com/zce.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qiniu-store\n\n[![Build Status][travis-image]][travis-url]\n[![Coverage Status][codecov-image]][codecov-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![NPM Version][version-image]][version-url]\n[![License][license-image]][license-url]\n[![Dependency Status][dependency-image]][dependency-url]\n[![devDependency Status][devdependency-image]][devdependency-url]\n[![Code Style][style-image]][style-url]\n\n\u003e Qiniu Storage for Ghost\n\n## Installation\n\n### Via Yarn or NPM\n\n- Install qiniu-store module\n\n  ```shell\n  $ yarn add qiniu-store\n  # or npm\n  $ npm install qiniu-store\n  ```\n\n- Make the storage folder if it doesn't exist yet\n\n  ```shell\n  $ mkdir -p content/adapters/storage\n  ```\n\n- Copy the module into the right location\n\n  ```shell\n  $ cp -vR node_modules/qiniu-store content/adapters/storage/qiniu\n  ```\n\n### Via Git\n\nIn order to replace the storage module, the basic requirements are:\n\n- Create a new folder inside `content/adapters` called `storage`\n\n  ```shell\n  $ mkdir -p content/adapters/storage\n  ```\n\n- Clone this repo to `storage`\n\n  ```shell\n  $ cd [path/to/ghost]/content/adapters/storage\n  $ git clone https://github.com/zce/qiniu-store.git qiniu --depth 1\n  ```\n\n- Install dependencies\n\n  ```shell\n  $ cd qiniu\n  $ yarn # or npm install\n  ```\n\n## Usage\n\n### Ghost Adapter\n\nIn your `config.[env].json` file, you'll need to add a new `storage` block to whichever environment you want to change:\n\n```json\n{\n  \"storage\": {\n    \"active\": \"qiniu\",\n    \"qiniu\": {\n      \"accessKey\": \"\u003cyour access key\u003e\",\n      \"secretKey\": \"\u003cyour secret key\u003e\",\n      \"bucket\": \"\u003cyour bucket name\u003e\",\n      \"domain\": \"\u003cyour bucket domain\u003e\",\n      \"format\": \"${year}/${month}/${name}${ext}\"\n    }\n  }\n}\n```\n\n#### Available format variables\n\n- `${year}`: 4 digit years\n- `${month}`: 2 digit months\n- `${day}`: 2 digit date\n- `${hour}`: 2 digit hours\n- `${timestamp}`: Unix ms timestamp\n- `${random}`: 8 digit random\n- `${uuid}`: uuid\n- `${name}`: original file name\n- `${ext}`: original file ext\n\n##### Default format\n\n`\"${year}/${month}/${name}${ext}\"`\n\n##### Full example format\n\n`\"${year}/${month}/${day}/${hour}/${name}-${uuid}-${timestamp}-${random}${ext}\"`\n\n### Programatically\n\n```javascript\nconst QiniuStore = require('qiniu-store')\nconst store = QiniuStore({\n  accessKey: '\u003cyour access key\u003e',\n  secretKey: '\u003cyour secret key\u003e',\n  bucket: '\u003cyour bucket name\u003e',\n  domain: '\u003cyour bucket domain\u003e',\n  format: '${year}/${month}/${name}${ext}'\n})\n\n// save file\nconst file = { name: 'wow.png', path: '/Users/zce/Pictures/mono.png' }\nstore.save(file, '2018/10')\n\n// read file\nstore.read({ path: '2018/10/wow.png' })\n\n// exists file\nstore.exists('wow.png', '2018/10')\n```\n\n## API\n\n### QiniuStore(options)\n\nQiniuStore constructor\n\n#### options\n\n##### accessKey\n\n- Type: `string`\n- Details: qiniu access key.\n\n##### secretKey\n\n- Type: `string`\n- Details: qiniu secret key.\n\n##### bucket\n\n- Type: `string`\n- Details: qiniu bucket name.\n\n##### domain\n\n- Type: `string`\n- Details: qiniu bucket domain.\n\n##### format\n\n- Type: `string`\n- Details: file path format.\n- Default: '${year}/${month}/${name}${ext}'\n\n### QiniuStore.prototype.save(file[, targetDir])\n\nSave file to Qiniu storage, Returns a Promise for file url String.\n\n#### file\n\n##### name\n\n- Type: `string`\n- Details: the name of the file to upload.\n\n##### path\n\n- Type: `string`\n- Details: the path of the file to upload.\n\n#### targetDir\n\n- Type: `string`\n- Details: specific upload path.\n\n### QiniuStore.prototype.read(file)\n\nRead file from Qiniu storage, Returns a Promise for file buffer Buffer.\n\n#### file\n\n##### path\n\n- Type: `string`\n- Details: the path of the file.\n\n### QiniuStore.prototype.exists(filename[, targetDir])\n\nReturns a Promise for file exists.\n\n#### filename\n\n- Type: `string`\n- Details: the name of the file.\n\n#### targetDir\n\n- Type: `string`\n- Details: specific file direcory path.\n\n### :construction: QiniuStore.prototype.delete(filename[, targetDir])\n\n#### filename\n\n- Type: `string`\n- Details: the name of the file.\n\n#### targetDir\n\n- Type: `string`\n- Details: specific file direcory path.\n\n## Contributing\n\n1. **Fork** it on GitHub!\n2. **Clone** the fork to your own machine.\n3. **Checkout** your feature branch: `git checkout -b my-awesome-feature`\n4. **Commit** your changes to your own branch: `git commit -am 'Add some feature'`\n5. **Push** your work back up to your fork: `git push -u origin my-awesome-feature`\n6. Submit a **Pull Request** so that we can review your changes.\n\n\u003e **NOTE**: Be sure to merge the latest from \"upstream\" before making a pull request!\n\n## License\n\n[MIT](LICENSE) \u0026copy; zce \u003cw@zce.me\u003e (https://zce.me/)\n\n\n\n[travis-image]: https://img.shields.io/travis/zce/qiniu-store.svg\n[travis-url]: https://travis-ci.org/zce/qiniu-store\n[codecov-image]: https://img.shields.io/codecov/c/github/zce/qiniu-store.svg\n[codecov-url]: https://codecov.io/gh/zce/qiniu-store\n[downloads-image]: https://img.shields.io/npm/dm/qiniu-store.svg\n[downloads-url]: https://npmjs.org/package/qiniu-store\n[version-image]: https://img.shields.io/npm/v/qiniu-store.svg\n[version-url]: https://npmjs.org/package/qiniu-store\n[license-image]: https://img.shields.io/npm/l/qiniu-store.svg\n[license-url]: https://github.com/zce/qiniu-store/blob/master/LICENSE\n[dependency-image]: https://img.shields.io/david/zce/qiniu-store.svg\n[dependency-url]: https://david-dm.org/zce/qiniu-store\n[devdependency-image]: https://img.shields.io/david/dev/zce/qiniu-store.svg\n[devdependency-url]: https://david-dm.org/zce/qiniu-store?type=dev\n[style-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[style-url]: http://standardjs.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fqiniu-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzce%2Fqiniu-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fqiniu-store/lists"}