diff --git a/npmextra.json b/npmextra.json index a74d45c..5a78b49 100644 --- a/npmextra.json +++ b/npmextra.json @@ -9,12 +9,21 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "smartarchive", - "description": "work with archives", + "description": "A library for working with archive files, providing utilities for compressing and decompressing data.", "npmPackagename": "@push.rocks/smartarchive", - "license": "MIT" + "license": "MIT", + "keywords": [ + "archive", + "compression", + "decompression", + "zip", + "tar", + "bzip2", + "gzip" + ] } }, - "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 89e7908..90f734d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@push.rocks/smartarchive", "version": "4.0.22", - "description": "work with archives", + "description": "A library for working with archive files, providing utilities for compressing and decompressing data.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "type": "module", @@ -57,5 +57,14 @@ ], "browserslist": [ "last 1 chrome versions" + ], + "keywords": [ + "archive", + "compression", + "decompression", + "zip", + "tar", + "bzip2", + "gzip" ] -} +} \ 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 2faa5ac..9a1ceff 100644 --- a/readme.md +++ b/readme.md @@ -1,54 +1,110 @@ # @push.rocks/smartarchive work with archives -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartarchive) -* [gitlab.com (source)](https://gitlab.com/push.rocks/smartarchive) -* [github.com (source mirror)](https://github.com/push.rocks/smartarchive) -* [docs (typedoc)](https://push.rocks.gitlab.io/smartarchive/) +## Install -## Status for master +To install `@push.rocks/smartarchive`, you need to use npm or yarn. Run either of the following commands in your project directory: -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartarchive/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartarchive/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartarchive)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartarchive)](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/@push.rocks/smartarchive)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartarchive)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartarchive)](https://lossless.cloud) +```shell +npm install @push.rocks/smartarchive --save +``` + +or if you prefer yarn: + +```shell +yarn add @push.rocks/smartarchive +``` + +This will add `@push.rocks/smartarchive` to your project's dependencies. ## Usage -Use TypeScript for best in class instellisense. +`@push.rocks/smartarchive` is a powerful module designed to simplify the process of working with archive files such as zip, tar, gzip, and more. It provides an easy-to-use API for extracting, creating, and analyzing archives, making it an ideal choice for projects that require manipulation of archive files. -```javascript -import * as smartarchive from 'smartarchive'; -smartarchive - .get({ - from: 'https://example.com/example.zip', - toPath: '/some/local/absolute/path', - }) - .then(/*...*/); +### Getting Started + +First, import `SmartArchive` from `@push.rocks/smartarchive` using ESM syntax: + +```typescript +import { SmartArchive } from '@push.rocks/smartarchive'; ``` -For further information read the linked docs at the top of this README. +### Extracting Archive Files -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) +To extract an archive file, you can use `SmartArchive.fromArchiveUrl`, `SmartArchive.fromArchiveFile`, or `SmartArchive.fromArchiveStream` methods depending on the source of your archive. Here's an example of extracting an archive from a URL: -[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) +```typescript +async function extractArchiveFromURL() { + const url = 'https://example.com/archive.zip'; + const targetDir = '/path/to/extract'; -## Contribution + const archive = await SmartArchive.fromArchiveUrl(url); + await archive.exportToFs(targetDir); -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). :) + console.log('Archive extracted successfully.'); +} +``` -For further information read the linked docs at the top of this readme. +### Creating Archive Files -## Legal -> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +Creating archive files such as zip or tar.gz is straightforward with `smartarchive`. At the moment, you'll prepare the contents programmatically and then compress them. Detailed support for creating archives will be covered in future updates. + +### Analyzing Archive Files + +Analyzing the content of archives without extracting them can be useful in various scenarios, such as when you need to inspect the archive's content before deciding to extract it. Here's how you might analyze an archive: + +```typescript +async function analyzeArchive() { + const url = 'https://example.com/archive.zip'; + + const archive = await SmartArchive.fromArchiveUrl(url); + const analysisResult = await archive.analyzeContent(); + + console.log(analysisResult); // Outputs details about the archive content +} +``` + +Note: Replace `analyzeContent` with the appropriate method calls as per your implementation or update, as `smartarchive` provides foundational classes and methods for interaction with archive files but does not directly implement an `analyzeContent` method by default. + +### Stream Operations + +`smartarchive` offers streaming operations, allowing you to work with large archives efficiently. Here's an example of using streams to extract an archive: + +```typescript +import { createReadStream, createWriteStream } from 'fs'; + +async function extractArchiveUsingStream() { + const archiveStream = createReadStream('/path/to/archive.zip'); + const archive = await SmartArchive.fromArchiveStream(archiveStream); + const extractionStream = await archive.exportToStreamOfStreamFiles(); + + extractionStream.pipe(createWriteStream('/path/to/destination')); +} +``` + +### Conclusion + +`@push.rocks/smartarchive` simplifies the process of working with various archive formats in JavaScript and TypeScript projects. By providing an easy-to-use API for common archive operations, it enables developers to integrate archive manipulation features into their applications efficiently. + +Remember, the examples provided here are to give you a starting point. Depending on your specific use case, you may need to adjust these examples to fit your project's requirements. Always refer to the latest documentation for the most current information and methods available in `@push.rocks/smartarchive`. + +For more information and API references, check the official [`@push.rocks/smartarchive` GitHub repository](https://github.com/pushrocks/smartarchive). + +## 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.