{"id":13650784,"url":"https://github.com/molobala/moleculer-flydrive","last_synced_at":"2026-02-18T13:09:17.269Z","repository":{"id":91401275,"uuid":"128653531","full_name":"molobala/moleculer-flydrive","owner":"molobala","description":"Moleculer storage management addon","archived":false,"fork":false,"pushed_at":"2018-05-16T15:11:23.000Z","size":16,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T02:05:10.423Z","etag":null,"topics":["addons","flydrive","moleculer"],"latest_commit_sha":null,"homepage":"","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/molobala.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-04-08T15:10:41.000Z","updated_at":"2022-01-27T16:28:35.000Z","dependencies_parsed_at":"2023-04-11T18:32:09.756Z","dependency_job_id":null,"html_url":"https://github.com/molobala/moleculer-flydrive","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molobala%2Fmoleculer-flydrive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molobala%2Fmoleculer-flydrive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molobala%2Fmoleculer-flydrive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/molobala%2Fmoleculer-flydrive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/molobala","download_url":"https://codeload.github.com/molobala/moleculer-flydrive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223903170,"owners_count":17222496,"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":["addons","flydrive","moleculer"],"created_at":"2024-08-02T02:00:40.981Z","updated_at":"2026-02-18T13:09:12.248Z","avatar_url":"https://github.com/molobala.png","language":"JavaScript","funding_links":[],"categories":["Services"],"sub_categories":["General"],"readme":"![Moleculer logo](http://moleculer.services/images/banner.png)\n\n# moleculer-flydrive\n\nFluent storage manager service with [Node Flydrive](https://github.com/Slynova-Org/node-flydrive).  \nYou need to install `@slynova/node-flydrive`\n\n## Features\n- Local\n- Amazon S3 (You need to install aws-sdk package to be able to use this driver)\n- Digital Ocean Spaces (You need to install aws-sdk package to be able to use this driver)\n- FTP (You need to install jsftp package to be able to use this driver)\n- Possibility to register a custome driver like [Google Drive driver](https://github.com/molobala/flydrive-google-drive)\n## Instalation\n`npm install moleculer-flydrive`\n## Usage\n**With no settings (it will mount local storage driver by default with the current directory** as root dir)\n```js\n\"use strict\"\nconst FlyDrive = require(\"moleculer-flydrive\");\nconst { ServiceBroker } = require(\"moleculer\");\nconst broker = new ServiceBroker();\nbroker.createService(FlyDrive(),{\n  actions: {\n    async someAction(ctx){\n      //let result = await this.storage.disk().exists(\"some-file.txt\");\n      //let result = await this.storage.disk(\"local\").exists(\"some-file.txt\");\n      let result = await this.storage.exists(\"some-file.txt\");//will use the default storage defined\n      if(result){\n        await this.storage.delete(\"some-file.txt\");\n      }\n    }\n  }\n})\n\n```\n**With settings**\n```js\n\"use strict\"\nconst FlyDrive = require(\"moleculer-flydrive\");\nconst { ServiceBroker } = require(\"moleculer\");\nconst broker = new ServiceBroker();\n//when true passed as param the service will try to create the root dir\nbroker.createService(FlyDrive(true),{\n  settings:{\n    STORAGE_ROOT:\"\u003ca path\u003e\",\n    storageConfig:{\n      default: \"local\",\n      disks:{\n        local: {\n          driver: \"local\"\n        },\n        s3: {\n          driver: 's3',\n          key: 'AWS_S3_KEY',\n          secret: 'AWS_S3_SECRET',\n          region: 'AWS_S3_REGION',\n          bucket: 'AWS_S3_BUCKET'\n        },\n        ftp: {\n          driver: 'ftp',\n          host: 'FTP_HOST',\n          port: 21,\n          user: 'FTP_USER',\n          pass: 'FTP_PASS',\n          longLive: false\n        },\n      }\n    }\n  },\n  actions: {\n    async someAction(ctx){\n      //let result = await this.storage.disk().exists(\"some-file.txt\");\n      //let result = await this.storage.disk(\"s3\").exists(\"some-file.txt\");\n      let result = await this.storage.exists(\"some-file.txt\");//will use the default storage defined\n      if(result){\n        await this.storage.delete(\"some-file.txt\");\n      }\n    }\n  }\n})\n```\n**Register a custom drive**\n\n```js\n\"use strict\"\nconst FlyDrive = require(\"moleculer-flydrive\");\nconst GoogleDrive = require(\"flydrive-google-drive\");\nconst { ServiceBroker } = require(\"moleculer\");\nconst broker = new ServiceBroker();\n//when true passed as param the service will try to create the root dir\nbroker.createService(FlyDrive(true),{\n  settings:{\n    STORAGE_ROOT:\"\u003ca path\u003e\",\n    defaultStorage: \"local\",\n    storageConfig:{\n      disks:{\n        local: {\n          driver: \"local\"\n        },\n        s3: {\n          driver: 's3',\n          key: 'AWS_S3_KEY',\n          secret: 'AWS_S3_SECRET',\n          region: 'AWS_S3_REGION',\n          bucket: 'AWS_S3_BUCKET'\n        },\n        ftp: {\n          driver: 'ftp',\n          host: 'FTP_HOST',\n          port: 21,\n          user: 'FTP_USER',\n          pass: 'FTP_PASS',\n          longLive: false\n        },\n        //register the driver configuration\n        drive: {\n          driver: \"drive\",\n          clientId: \"GOOGLE_DRIVE_CLIENT_ID\",\n          clientSecret: \"GOOGLE_DRIVE_CLIENT_SECRET\",\n          redirectUrl: \"GOOGLE_DRIVE_REDIRECT_URL\",\n          access_token: \"GOOGLE_DRIVE_ACCESS_TOKEN\",\n          refresh_token: \"GOOGLE_DRIVE_REFRESH_TOKEN\"\n        }\n      },\n      //register the driver hanlder\n      customDrivers: {\n        drive: GoogleDrive\n      }\n    }\n  }\n})\n```\n\n## Settings\n| Property | Type | Description |\n| -------- | -----| ----------- |\n| `STORAGE_ROOT` | `String` | The root directory for local storage driver|\n| `defaultStorage` | `String` | the default driver to use, if not sepecified, `local` will be used  |\n| `storageConfig` | `Object` | the configuration object, refer to [Configuration object](https://github.com/Slynova-Org/node-flydrive/blob/master/tests/stubs/config.js) for more details |\n\n\n## Methods\n| Name | Params | Result | Description |\n| ---- | ------ | ------ | ----------- |\n| disk | `String or undefined` | [`Storage`](https://github.com/Slynova-Org/node-flydrive/blob/master/src/Storage.js) instance| get a specifique disk storage or the default storage if no param passes. |\n| extends | name:`String`,driver: `Object constructor` | the [`StorageManager`](https://github.com/Slynova-Org/node-flydrive/blob/master/src/StorageManager.js) instance | extends the storage manager, the new driver configuration should have been defined in configuration. Refer to [How to register custome driver](https://github.com/Slynova-Org/node-flydrive/wiki/Register-a-custom-driver) |\n\n## Test\nYou can run `npm run test` to run tests\n\n## Licence\n**MIT**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmolobala%2Fmoleculer-flydrive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmolobala%2Fmoleculer-flydrive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmolobala%2Fmoleculer-flydrive/lists"}