Comparing version 1.0.4 to 1.0.5
import { Zipster } from './Zipster'; | ||
import { Formats } from './enums/Formats'; | ||
import { Options } from './types/Options'; | ||
import { FileParts } from './libs/FileParts'; | ||
import { ZipsterError } from './errors/ZipsterError'; | ||
export { Zipster, Formats, Options, ZipsterError }; | ||
export { Zipster, Formats, Options, FileParts, ZipsterError }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,4 +7,6 @@ "use strict"; | ||
exports.Formats = Formats_1.Formats; | ||
const FileParts_1 = require("./libs/FileParts"); | ||
exports.FileParts = FileParts_1.FileParts; | ||
const ZipsterError_1 = require("./errors/ZipsterError"); | ||
exports.ZipsterError = ZipsterError_1.ZipsterError; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "zipster", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "TypeScript library built for Node backends to create ZIP files with password protection", | ||
@@ -11,4 +11,16 @@ "main": "lib/index.js", | ||
"build": "tsc", | ||
"test": "mocha --config ./test/support/unit.yml" | ||
"test": "mocha --config ./test/support/unit.yml", | ||
"coverage": "nyc npm run test" | ||
}, | ||
"keywords": [ | ||
"ZIP", | ||
"password", | ||
"secure", | ||
"node", | ||
"typescript", | ||
"files", | ||
"compression", | ||
"compress", | ||
"bulk" | ||
], | ||
"files": [ | ||
@@ -15,0 +27,0 @@ "lib", |
109
README.md
# Zipster | ||
[![NPM Version](https://badge.fury.io/js/zipster.svg)](https://badge.fury.io/js/zipster) | ||
Zipster aims to enable developers to easily create password-protected ZIP files. This library relies on a combination of | ||
@@ -9,10 +11,33 @@ other libraries to function correctly as well as built-in Node functionality. | ||
**This project is still in development. Please report any bugs or feature requests as an | ||
**This project is still in development. Please report any bugs or feature requests as an | ||
[issue](https://github.com/ToeFungi/zipper/issues/new).** | ||
## Installation | ||
## Contents | ||
Use the following command to install the package: | ||
- [Getting Started](#getting-started) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Create a ZIP with a single file](#createpath-string-options-options) | ||
- [Create a ZIP with a multiple files](#createbulkpaths-string-options-options) | ||
- [Options](#options) | ||
- [Tests](#running-tests) | ||
- [Issues](#issues) | ||
- [Contributions](#contributions) | ||
- [License](#license) | ||
## Getting Started | ||
This is how to get a copy of this working locally. The only requirement is that Node is installed on the base machine. | ||
```bash | ||
$ git clone git@github.com:ToeFungi/zipster.git | ||
$ cd zipster | ||
$ npm i | ||
``` | ||
## Installation | ||
Use the following command to install the Zipster: | ||
``` | ||
npm i zipster | ||
@@ -23,19 +48,75 @@ ``` | ||
The following example will create a password-protected ZIP file called `protected.zip` in the execution directory, | ||
containing the `test.csv` with the password to access the ZIP being `foo-fighters`. | ||
You can create a ZIP file containing a single file or multiple files, set a password or not and configure how you want | ||
the ZIP to be created. | ||
#### .create(path: string, options: Options) | ||
Create ZIP file containing a single file | ||
```typescript | ||
const fileToZip = './src/test.csv' | ||
const path = '/some/path/to/my/file.txt' | ||
const options: Options = { | ||
format: Formats.ZIP_ENCRYPTABLE, | ||
password: 'foo-fighters', | ||
output: { | ||
name: 'protected', | ||
directory: __dirname | ||
} | ||
format: Formats.ZIP | ||
} | ||
const zipster = new Zipster() | ||
zipster.create(fileToZip, options) | ||
.then((outputDirectory: string) => console.log({ outputDirectory }, 'Successfully created ZIP')) | ||
zipster.create(path, options) | ||
.then((outputPath: string) => console.log({ outputPath }, 'Successfully created ZIP')) | ||
``` | ||
#### .createBulk(paths: string[], options: Options) | ||
Create ZIP file containing multiple files | ||
```typescript | ||
const path = [ | ||
'/some/path/to/my/file.txt', | ||
'/some/path/to/my/file.csv' | ||
] | ||
const options: Options = { | ||
format: Formats.ZIP | ||
} | ||
const zipster = new Zipster() | ||
zipster.createBulk(paths, options) | ||
.then((outputPath: string) => console.log({ outputPath }, 'Successfully created ZIP')) | ||
``` | ||
#### Options | ||
| Option | Default | Description | | ||
|-------------|-------------|------------------------------------------------------------| | ||
| format | null | Whether the ZIP should be password protected or not | | ||
| password | null | The password for the ZIP if applicable format is specified | | ||
| output name | UUID V4 | The name of the ZIP file to be created | | ||
| output path | OS Specific | The path to where the ZIP file should be created | | ||
## Tests | ||
To run tests, you should be able to simply run be able to run the following. | ||
```bash | ||
$ npm run test | ||
$ npm run coverage | ||
``` | ||
The testing framework used is Mocha. Chai, Chai-as-promised and nyc are used for assertions and coverage reporting | ||
respectively. Ensure that any new changes are covered by an accompanying test suite. | ||
## Issues | ||
If you find any problems while working with this library, please log an issue | ||
[here](https://github.com/ToeFungi/zipster/issues) so that development can begin to rectify the error. | ||
## Contributions | ||
This project is completely open source and as such, you are invited to make contributions. Fork the project, make some | ||
changes and make the pull request. If you have any feedback regarding the functionality, please don't hesitate to open | ||
an issue so this can be resolved. Please ensure that any pull requests have unit tests that cover any additional | ||
functionality. | ||
## License | ||
MIT License | ||
Copyright (c) 2021 Alex Pickering |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
34456
597
121