From 6a4c302de0d5f93ba3041ab765262252db0b573f Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 14 Apr 2024 17:31:35 +0200 Subject: [PATCH] update tsconfig --- npmextra.json | 14 +++++- package.json | 11 ++++- readme.hints.md | 1 + readme.md | 123 +++++++++++++++++++++++++++++++++++------------- 4 files changed, 114 insertions(+), 35 deletions(-) create mode 100644 readme.hints.md diff --git a/npmextra.json b/npmextra.json index 198c05f..ea68eb5 100644 --- a/npmextra.json +++ b/npmextra.json @@ -11,10 +11,20 @@ "gitrepo": "smartdrive", "shortDescription": "a module for drive data and mount management", "npmPackagename": "@push.rocks/smartdrive", - "license": "MIT" + "license": "MIT", + "description": "A module for managing drive data and mount points, supporting both local and cloud storage.", + "keywords": [ + "drive management", + "data management", + "mount management", + "local storage", + "cloud storage", + "typescript", + "node.js" + ] } }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index 9372bb8..488eb43 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@push.rocks/smartdrive", "version": "1.0.9", - "description": "do more with local and cloud drives", + "description": "A module for managing drive data and mount points, supporting both local and cloud storage.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "author": "Lossless GmbH", @@ -36,5 +36,14 @@ "cli.js", "npmextra.json", "readme.md" + ], + "keywords": [ + "drive management", + "data management", + "mount management", + "local storage", + "cloud storage", + "typescript", + "node.js" ] } \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index 8a02904..424831d 100644 --- a/readme.md +++ b/readme.md @@ -1,47 +1,106 @@ -# @pushrocks/smartdrive -a module for drive data and mount management +# @push.rocks/smartdrive +do more with local and cloud drives -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdrive) -* [gitlab.com (source)](https://gitlab.com/pushrocks/smartdrive) -* [github.com (source mirror)](https://github.com/pushrocks/smartdrive) -* [docs (typedoc)](https://pushrocks.gitlab.io/smartdrive/) +## Install -## Status for master +To install `@push.rocks/smartdrive`, you need Node.js installed on your system. If you have Node.js installed, you can simply run the following command in your terminal: -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartdrive/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartdrive/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartdrive)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartdrive)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartdrive)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartdrive)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartdrive)](https://lossless.cloud) -Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud) +```shell +npm install @push.rocks/smartdrive --save +``` + +This will download `@push.rocks/smartdrive` and add it as a dependency to your project's `package.json` file. ## Usage -Use TypeScript for best in class instellisense. +`@push.rocks/smartdrive` offers an easy-to-use interface for interacting with local and cloud drives. Let's explore the capabilities of this module with TypeScript examples. To get the most out of these examples, ensure you are familiar with TypeScript and have it set up in your project. -For further information read the linked docs at the top of this README. +### Getting Started -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) +Before using any functionalities, you need to import the module into your TypeScript file. Here's how you can do that using ES Module syntax: -[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) +```typescript +import { SmartDrive } from '@push.rocks/smartdrive'; +``` +### Listing Local Drives -## Contribution +One of the primary features of `@push.rocks/smartdrive` is the ability to list all local drives. This is useful for applications that need to perform operations like reading from or writing to external drives. Here's how you can list all local drives: -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +```typescript +import { SmartDrive } from '@push.rocks/smartdrive'; -For further information read the linked docs at the top of this readme. +const mySmartDrive = new SmartDrive(); -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +async function listLocalDrives() { + try { + const drives = await mySmartDrive.getLocalDriveList(); + console.log('Local Drives:', drives); + } catch (error) { + console.error('Error listing local drives:', error); + } +} -[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) +listLocalDrives(); +``` + +This function initializes a `SmartDrive` instance and calls the `getLocalDriveList` method. This method returns a Promise that resolves with an array of drives, each containing detailed information about the drive. + +### Mounting a Drive + +Mounting a drive programmatically can be particularly useful for applications that need to manage storage devices automatically. Below is an example of how to mount a drive by its name: + +```typescript +import { SmartDrive } from '@push.rocks/smartdrive'; + +const mySmartDrive = new SmartDrive(); + +async function mountDrive(devName: string) { + try { + await mySmartDrive.mountDeviceByName(devName); + console.log(`Drive ${devName} mounted successfully.`); + } catch (error) { + console.error(`Error mounting drive ${devName}:`, error); + } +} + +// Replace 'sdb1' with the actual device name you want to mount +mountDrive('sdb1'); +``` + +This example demonstrates how to mount a drive specified by its device name (e.g., 'sdb1'). Note that mounting drives usually requires administrative privileges, so ensure your application has the necessary permissions to perform this action. + +### Drive and Mount Point Management + +Managing drives and mount points is a complex operation that involves dealing with the file system and ensuring that resources are correctly handled to prevent data loss. The methods provided by `@push.rocks/smartdrive`, such as listing drives and mounting/unmounting them, serve as building blocks for more complex drive management logic. + +When designing features around drive management, consider: + +- Performing checks to ensure drives are not in use before unmounting. +- Providing clear feedback to users or calling applications about the success/failure of operations. +- Handling edge cases, such as attempting to mount a drive that is already mounted or has no recognizable file system. + +By responsibly managing local and cloud drives, applications can safely and efficiently interact with storage devices, enhancing the user's ability to manage their data across diverse storage solutions. + +### Conclusion + +`@push.rocks/smartdrive` offers a powerful and flexible way to interact with local and cloud storage solutions. Through its API, developers can list, mount, and manage drives within their Node.js applications. Properly leveraging these capabilities allows for the creation of robust storage management features, enhancing applications' usability and data handling efficiency. + +## License and Legal Information + +This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. + +**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. + +### Trademarks + +This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH. + +### Company Information + +Task Venture Capital GmbH +Registered at District court Bremen HRB 35230 HB, Germany + +For any legal inquiries or if you require further information, please contact us via email at hello@task.vc. + +By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.