{"id":20129320,"url":"https://github.com/aicore/linode-object-storage-lib","last_synced_at":"2025-04-09T16:09:24.549Z","repository":{"id":37972923,"uuid":"445463100","full_name":"aicore/linode-object-storage-lib","owner":"aicore","description":"A javascript based module to access and perform operations on Linode object storage via code.","archived":false,"fork":false,"pushed_at":"2025-04-04T21:53:03.000Z","size":259,"stargazers_count":5,"open_issues_count":10,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T16:09:18.685Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aicore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-07T09:15:17.000Z","updated_at":"2023-03-25T12:53:28.000Z","dependencies_parsed_at":"2023-10-13T11:53:11.896Z","dependency_job_id":"673d4ed7-794d-4f8e-8ba4-4ad982320e0f","html_url":"https://github.com/aicore/linode-object-storage-lib","commit_stats":{"total_commits":75,"total_committers":8,"mean_commits":9.375,"dds":0.6799999999999999,"last_synced_commit":"fe15f4e0743fba519ed5251ca1d5ea84013988bb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Flinode-object-storage-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Flinode-object-storage-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Flinode-object-storage-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Flinode-object-storage-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aicore","download_url":"https://codeload.github.com/aicore/linode-object-storage-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065283,"owners_count":21041871,"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-13T20:33:33.848Z","updated_at":"2025-04-09T16:09:24.526Z","avatar_url":"https://github.com/aicore.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linode Object Storage JS Module\nA javascript based module to access and perform operations on Linode object storage via code.\n\n## Code Guardian\n[![\u003capp\u003e build verification](https://github.com/aicore/linode-object-storage-lib/actions/workflows/build_verify.yml/badge.svg)](https://github.com/aicore/linode-object-storage-lib/actions/workflows/build_verify.yml)\n\n\u003ca href=\"https://sonarcloud.io/summary/new_code?id=aicore_linode-object-storage-lib\"\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=alert_status\" alt=\"Sonar code quality check\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=security_rating\" alt=\"Security rating\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=vulnerabilities\" alt=\"vulnerabilities\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=coverage\" alt=\"Code Coverage\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=bugs\" alt=\"Code Bugs\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=reliability_rating\" alt=\"Reliability Rating\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=sqale_rating\" alt=\"Maintainability Rating\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=ncloc\" alt=\"Lines of Code\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_linode-object-storage-lib\u0026metric=sqale_index\" alt=\"Technical debt\" /\u003e\n\u003c/a\u003e\n\n## Installing\n* \u003e npm i @aicore/linode-object-storage-lib\n\n## Usage\n### Prerequisite\n1. To upload a file to a bucket in Linode Object Storage users need to configure accessKey, secretKey and create a bucket.\n Please refer to the official Linode guide to generate an accessKey and create a bucket.\n\n   AccessKey Guide: https://www.linode.com/docs/products/storage/object-storage/guides/generate-access-keys/\n   \n   Creating a Bucket Guide: https://www.linode.com/docs/products/storage/object-storage/guides/create-bucket/\n2. To retrieve the shareable public file URL using Linode v4 API, users need to generate the API Key which is a mandatory parameter required for authentication. Please refer to following guide to generate the API Key.\n    \n    API Key Generation Guide: https://www.linode.com/docs/guides/getting-started-with-the-linode-api/\n\n## Code usage\n\n### Uploading File to Linode Bucket\n\nRequest Parameters :\n\n* **accessKeyId (type: String):** bucket specific unique identifier required for authentication\n* **secretAccessKey (type: String):** user specific unique identifier required for authentication\n* **region (type: String):** indicates the geographical server location (e.g us-east-1, eu-west-1a)\n* **file (type: String):** complete path of the file to be uploaded is passed on as a parameter\n* **bucket (type: String):** uniquely identifies the bucket where the file should be uploaded\n* **objectNameOverride (type: String):** Optional parameter, if given, the file name in linode will be overridden.\n\nPlease refer to https://docs.aws.amazon.com/sdk-for-javascript/index.html for more details.\n\n```js\n// import the module directly to your file\nimport linodeModule from 'linode_object_storage_module';\n\n//Example for uploading file to linode object storage\nconst response = await linodeModule.uploadFileToLinodeBucket(accessKeyId, \n    secretAccessKey, region, file, bucket);\n\n//Example if you want to change the file name in linode/ provide suctom upload location\nconst response = await linodeModule.uploadFileToBucket(accessKey, secretKey, region, fileName, bucketName, customPathInLinode);\n```\n\n### Fetching Object URL\n\nRequest Parameters :\n\n* **accessToken (type: String):** Linode API Key.\n* **clusterId (type: String):**  indicates the geographical server location (e.g 'us-east-1', 'eu-west-1a')\n* **bucketName (type: String):** Exact Name of the bucket the file resides in\n* **objectName (type: String):** Exact Name(not the path) of the the file in String\n\nPlease refer to the API Documentation for the complete list of path and request body parameters:\nhttps://www.linode.com/docs/api/object-storage/#object-storage-object-url-create\n\n```js\n//Example for retrieving the File object URL\nconst fileURL = await linodeModule.fetchObjectUrl(accessToken, \n    clusterId, bucketName, objectName);\n```\n\n```\nRequest Body:\n\ncurl -H \"Content-Type: application/json\" \\ -H \"Authorization: Bearer $TOKEN\" \\\n  -X POST -d '{\n      \"method\": \"GET\",\n      \"name\": \"example\"\n    }' \\\n  https://api.linode.com/v4/object-storage/buckets/us-east-1/example-bucket/object-url\n\nResponse Body:\n\n{\n  \"url\": \"https://us-east-1.linodeobjects.com/example-bucket/example?Signature=qr98TEucCntPgEG%2BsZQGDsJg93c%3D\\u0026Expires=1567609905\\u0026AWSAccessKeyId=G4YAF81XWY61DQM94SE0\"\n}\n\n```\n\n# Commands available\n## Building\nSince this is a pure JS template project, build command just runs test with coverage.\n```shell\n\u003e npm run build\n```\n\n## Linting\nTo lint the files in the project, run the following command:\n```shell\n\u003e npm run lint\n```\nTo Automatically fix lint errors:\n```shell\n\u003e npm run lint:fix\n```\n\n## Testing\nTo run all tests:\n```shell\n\u003e npm run test\n  Hello world Tests\n    ✔ should return Hello World\n    #indexOf()\n      ✔ should return -1 when the value is not present\n```\n\nAdditionally, to run unit/integration tests only, use the commands:\n```shell\n\u003e npm run test:unit\n\u003e npm run test:integ\n```\n\n## Coverage Reports\nTo run all tests with coverage:\n\n```shell\n\u003e npm run cover\n  Hello world Tests\n    ✔ should return Hello World\n    #indexOf()\n      ✔ should return -1 when the value is not present\n\n\n  2 passing (6ms)\n\n----------|---------|----------|---------|---------|-------------------\nFile      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\nAll files |     100 |      100 |     100 |     100 |                   \n index.js |     100 |      100 |     100 |     100 |                   \n----------|---------|----------|---------|---------|-------------------\n\n=============================== Coverage summary ===============================\nStatements   : 100% ( 5/5 )\nBranches     : 100% ( 2/2 )\nFunctions    : 100% ( 1/1 )\nLines        : 100% ( 5/5 )\n================================================================================\nDetailed unit test coverage report: file:///template-nodejs/coverage-unit/index.html\nDetailed integration test coverage report: file:///template-nodejs/coverage-integration/index.html\n```\nAfter running coverage, detailed reports can be found in the coverage folder listed in the output of coverage command.\nOpen the file in browser to view detailed reports.\n\nTo run unit/integration tests only with coverage\n```shell\n\u003e npm run cover:unit\n\u003e npm run cover:integ\n```\n\nSample coverage report:\n![image](https://user-images.githubusercontent.com/5336369/148687351-6d6c12a2-a232-433d-ab62-2cf5d39c96bd.png)\n\n### Unit and Integration coverage configs\nUnit and integration test coverage settings can be updated by configs `.nycrc.unit.json` and `.nycrc.integration.json`.\n\nSee https://github.com/istanbuljs/nyc for config options.\n\n# Code Guardian\nSeveral automated workflows that check code integrity are integrated into this template.\nThese include:\n1. GitHub actions that runs build/test/coverage flows when a contributor raises a pull request\n2. [Sonar cloud](https://sonarcloud.io/) integration using `.sonarcloud.properties`\n    1. In sonar cloud, enable Automatic analysis from `Administration\n       Analysis Method` for the first time ![image](https://user-images.githubusercontent.com/5336369/148695840-65585d04-5e59-450b-8794-54ca3c62b9fe.png)\n\n## IDE setup\nSonarLint is currently available as a free plugin for jetbrains, eclipse, vscode and visual studio IDEs.\nUse sonarLint plugin for webstorm or any of the available\nIDEs from this link before raising a pull request: https://www.sonarlint.org/ .\n\nSonarLint static code analysis checker is not yet available as a Brackets\nextension.\n\n## Internals\n### Testing framework: Mocha , assertion style: chai\nSee https://mochajs.org/#getting-started on how to write tests\nUse chai for BDD style assertions (expect, should etc..). See move here: https://www.chaijs.com/guide/styles/#expect\n\n### Mocks and spies: sinon\nif you want to mock/spy on fn() for unit tests, use sinon. refer docs: https://sinonjs.org/\n\n### Note on coverage suite used here:\nwe use c8 for coverage https://github.com/bcoe/c8. Its reporting is based on nyc, so detailed docs can be found\nhere: https://github.com/istanbuljs/nyc ; We didn't use nyc as it do not yet have ES module support\nsee: https://github.com/digitalbazaar/bedrock-test/issues/16 . c8 is drop replacement for nyc coverage reporting tool\n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faicore%2Flinode-object-storage-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faicore%2Flinode-object-storage-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faicore%2Flinode-object-storage-lib/lists"}