{"id":15365869,"url":"https://github.com/ryouaki/nodejs-swiftclient","last_synced_at":"2025-04-15T10:50:24.605Z","repository":{"id":34072018,"uuid":"167474773","full_name":"ryouaki/nodejs-swiftclient","owner":"ryouaki","description":"The promise support client for openstack with nodejs","archived":false,"fork":false,"pushed_at":"2023-01-04T21:50:19.000Z","size":1125,"stargazers_count":4,"open_issues_count":15,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T19:13:02.240Z","etag":null,"topics":["client","nodejs","openstack-swift","promise"],"latest_commit_sha":null,"homepage":"","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/ryouaki.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-01-25T02:54:11.000Z","updated_at":"2019-09-16T09:15:52.000Z","dependencies_parsed_at":"2023-01-15T04:24:54.747Z","dependency_job_id":null,"html_url":"https://github.com/ryouaki/nodejs-swiftclient","commit_stats":null,"previous_names":["ryouaki/swift-nodeclient"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryouaki%2Fnodejs-swiftclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryouaki%2Fnodejs-swiftclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryouaki%2Fnodejs-swiftclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryouaki%2Fnodejs-swiftclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryouaki","download_url":"https://codeload.github.com/ryouaki/nodejs-swiftclient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249057488,"owners_count":21205904,"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":["client","nodejs","openstack-swift","promise"],"created_at":"2024-10-01T13:16:32.371Z","updated_at":"2025-04-15T10:50:24.586Z","avatar_url":"https://github.com/ryouaki.png","language":"JavaScript","readme":"\n[![npm downloads](https://img.shields.io/npm/dm/swift-nodeclient.svg?style=flat-square)](http://npm-stat.com/charts.html?package=swift-nodeclient)\n\n# swift-nodeclient\nThe promise support client for openstack with nodejs\n\n# How to use it.\n[example](/example/index.js)\n\n# How to install it.\n```sh\n  $ npm i swift-nodeclient -save\n```\n\n# How to run the example.\n```sh\n  $ node ./example/index.js\n```\n\n# API\n```js\n  const client = new NodeSwift({\n    host: \"127.0.0.1\", // the location of swift server, if not assign port ,will only use host option.\n    port: 12345, // the port of swift server\n    authUrl: '' // the auth url .default /auth/v1.0\n  });\n  \n  /**\n   * Login\n   * \n   * @param {String|required} account  \n   * @param {String|required} user     \n   * @param {String|required} password \n   * \n   * @return {Promise} success \n   *    {\n   *      status: 'ok',\n   *      msg: null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.login({\n    account: 'test',\n    user:'tester',\n    password:'testing'\n  }).then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n  \n  /**\n   * Get Container list\n   * \n   * @return {Promise} success \n   *    {\n   *      \"status\": \"ok\",\n   *      \"msg\": {\n   *        \"bytesUsed\": \"545636\",\n   *        \"containerCount\": \"2\",\n   *        \"objectCount\": \"2\",\n   *        \"data\": [\n   *          \"test\",\n   *          \"test1\"\n   *        ]\n   *      }\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.getContainers().then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * Create a new Container\n   * \n   * @param {String|required} container \n   * \n   * @return {Promise} success \n   *    {\n   *      status: 'ok',\n   *      msg: null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.newContainer('test').then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * Create a new Container\n   * for option items ref: https://docs.openstack.org/swift/latest/overview_acl.html#container-acls\n   * \n   * @param {String|required} container\n   * @param {Object|option} { headers: {'X-Container-Read': '.r:* | .r:\u003creferrer\u003e' } }\n   * \n   * @return {Promise} success \n   *    {\n   *      status: 'ok',\n   *      msg: null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.newContainer('test1', {\n    headers: {\n      'X-Container-Read': '.r:*'\n    }\n  }).then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * Delete a Container\n   * \n   * @param {String|required} container\n   * \n   * @return {Promise} success \n   *    {\n   *      status: 'ok',\n   *      msg: null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.delContainer('test1').then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * Create a text Object\n   * \n   * @param {String|required} container\n   * @param {String|required} object\n   * @param {String|Stream|required} data\n   * @param {Object|option} { headers: {'Content-Type': 'text/html' } }\n   * \n   * @return {Promise} success \n   *    {\n   *      status: 'ok',\n   *      msg: null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.newObject('test', 'object1', 'hello world', {\n    headers: {\n      'Content-Type': 'text/html'\n    }\n  }).then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  const stream = fs.createReadStream('./example/WechatIMG127.jpeg');\n  /**\n   * Create a text Object\n   * \n   * @param {String|required} container\n   * @param {String|required} object\n   * @param {String|Stream|required} data\n   * @param {Object|option} { headers: {'Content-Type': 'image/jpeg' } }\n   * \n   * @return {Promise} success \n   *    {\n   *      status: 'ok',\n   *      msg: null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.newObject('test', 'object2', stream, {\n    headers: {\n      'Content-Type': 'image/jpeg'\n    }\n  }).then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * Update a Object\n   * \n   * @param {String|required} container\n   * @param {String|required} object\n   * @param {String|Stream|required} data\n   * @param {Object|option} { headers: {'Content-Type': 'image/jpeg' } }\n   * \n   * @return {Promise} success \n   *    {\n   *      status: 'ok',\n   *      msg: null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.updateObject('test', 'object1', 'hello world two', {\n    headers: {\n      'Content-Type': 'text/html'\n    }\n  }).then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * Get object list\n   * \n   * @param {String|required} container\n   * \n   * @return {Promise} success \n   *    {\n   *      \"status\": \"ok\",\n   *      \"msg\": {\n   *        \"bytesUsed\": \"545636\",\n   *        \"objectCount\": \"2\",\n   *        \"data\": [\n   *          \"test\",\n   *          \"test1\"\n   *        ]\n   *      }\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.getObjects('test').then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * Delete a Object\n   * \n   * @param {String|required} container\n   * @param {String|required} object\n   * \n   * @return {Promise} success \n   *    {\n   *      \"status\": \"ok\",\n   *      \"msg\": null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.delObject('test', 'object1').then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n\n  /**\n   * copy a Object to a new path\n   * \n   * @param {String|required} fromContainer\n   * @param {String|required} fromobject\n   * @param {String|required} toContainer\n   * @param {String|required} toObject\n   * \n   * @return {Promise} success \n   *    {\n   *      \"status\": \"ok\",\n   *      \"msg\": null\n   *    }\n   * @return {Promise} failed \n   *    {\n   *      status: 'ng',\n   *      msg: {...}\n   *    }\n   */\n  await client.copyObject('test', 'object2', 'test1', 'object1').then((d) =\u003e {\n    printObj(d);\n  }).catch((e) =\u003e {\n    printErr(e);\n  })\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryouaki%2Fnodejs-swiftclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryouaki%2Fnodejs-swiftclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryouaki%2Fnodejs-swiftclient/lists"}