{"id":18544735,"url":"https://github.com/131/swift","last_synced_at":"2025-06-15T00:33:48.100Z","repository":{"id":57376105,"uuid":"150485487","full_name":"131/swift","owner":"131","description":"Openstack swift API","archived":false,"fork":false,"pushed_at":"2021-09-15T16:09:13.000Z","size":50,"stargazers_count":4,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-14T08:49:40.888Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/131.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":"2018-09-26T20:21:40.000Z","updated_at":"2024-04-18T04:10:20.000Z","dependencies_parsed_at":"2022-09-02T19:32:08.433Z","dependency_job_id":null,"html_url":"https://github.com/131/swift","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/131/swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fswift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fswift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fswift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fswift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/131","download_url":"https://codeload.github.com/131/swift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fswift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259905406,"owners_count":22929916,"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-06T20:17:27.212Z","updated_at":"2025-06-15T00:33:48.077Z","avatar_url":"https://github.com/131.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Openstack *swift* client API with ES7 async/await design.\n\n[![Build Status](https://github.com/131/swift/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/131/swift/actions/workflows/test.yml)\n[![NPM Version](https://img.shields.io/npm/v/swift.svg?style=flat)](https://www.npmjs.org/package/swift)\n[![Coverage Status](https://img.shields.io/coveralls/131/swift.svg?style=flat)](https://coveralls.io/r/131/swift?branch=master)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n[![Code style](https://img.shields.io/badge/code%2fstyle-ivs-green.svg)](https://www.npmjs.com/package/eslint-plugin-ivs)\n\n\n\n\n# Installation\n\n```bash\n$ npm install swift\n```\n\n\n# API/services (auth3)\nAuth3 API will login to your openstack and use a X-Auth-Token in all operations.\nMake sure to renew (setInterval) the auth token periodicaly.\n\n## credentials\n```js\n\"use strict\";\n\nmodule.exports = {\n    authUrl : \"https://auth.cloud.ovh.net/v3\", // default\n    username : \"OpenstackUsername\", // required\n    password : \"OpenstackPassword\", // required\n    tenantId : \"OpenstackProjectId\", // one of tenantId or tenantName is required\n    tenantName : \"OpenstackProjectName\", // one of tenantId or tenantName is required\n    region: \"WAW\", // default \"GRA3\"\n};\n\n```\n\n\n## object-store \n```js\n\"use strict\";\n\nconst fs      = require('fs');\nconst Context = require('swift/context');\nconst storage = require('swift/storage');\n\nconst pipe    = require('nyks/stream/pipe');\nconst creds   = require('./credentials');\n\n\n\nclass foo {\n  async run(){\n    // init token\n\n    let container = 'mediaprivate';\n\n    var ctx = await Context.build(creds);\n\n    var files = await storage.toggleMode(ctx, container, \".r:*,.rlistings\");\n    var headers = await storage.showContainer(ctx, container);\n\n\n    var remote = await storage.putFile(ctx, 'boucs.jpg', container, 'bouc.jpg');\n    var local = fs.createWriteStream('tmp.jpg');\n\n    var remote = storage.download(ctx, container, 'bouc.jpg');\n\n    await pipe(remote, local);\n\n    var remote = await storage.deleteFile(ctx, container, 'bouc.jpg');\n\n    var files = await storage.getFileList(ctx, container);\n    console.log({files, remote});\n  }\n}\n\n\nmodule.exports = foo;\n```\n\n\n# API/services (meta-temp-url-key)\nUsing a container meta-temp key, you can upload, retrieve or delete specific files in your container.\nOn a CAS designed container, this should be considered as a best practice against a full container access.\n\n## object-store \n```js\n\"use strict\";\n\nconst fs      = require('fs');\nconst Context = require('swift/context');\nconst storage = require('swift/storage');\n\nconst pipe    = require('nyks/stream/pipe');\nconst creds   = {\n \"containers\" : {\n\n    \"mediaprivate\" : {\n        \"endpoint\"     : \"https://someopenstackswifthost/v1/AUTH_PROJECTID/mediaprivate\",\n        \"temp-url-key\" : \"somesecret\",\n    }\n }\n\n};\n\n\nclass foo {\n  async run(){\n\n    let container = 'mediaprivate';\n\n\n    // does not init token, as no username is provided\n    var ctx = await Context.build(creds);\n\n    //please note that container level API won't work\n    //var files = await storage.toggleMode(ctx, container, \".r:*,.rlistings\");\n    //var headers = await storage.showContainer(ctx, container);\n\n\n    var remote = await storage.putFile(ctx, 'boucs.jpg', container, 'bouc.jpg');\n    var local = fs.createWriteStream('tmp.jpg');\n\n      //download through tempURL\n    var remote = storage.download(ctx, container, 'bouc.jpg');\n\n    await pipe(remote, local);\n\n    var remote = await storage.deleteFile(ctx, container, 'bouc.jpg');\n\n    var files = await storage.getFileList(ctx, container);\n    console.log({files, remote});\n  }\n}\n\n\nmodule.exports = foo;\n```\n\n\n\n\n# Credits\n* [131](https://github.com/131)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F131%2Fswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fswift/lists"}