Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zipster

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zipster - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

6

lib/libs/FileParts.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const nodePath = require("path");
const guarder_1 = require("guarder");
const ZipsterError_1 = require("../errors/ZipsterError");

@@ -12,5 +13,4 @@ /**

.split('.');
if (!fileName || !fileExtension) {
throw new ZipsterError_1.ZipsterError('Path missing file name or file extension');
}
guarder_1.Guarder.empty(fileName, 'Path missing file name', ZipsterError_1.ZipsterError);
guarder_1.Guarder.empty(fileExtension, 'Path missing file extension', ZipsterError_1.ZipsterError);
this.path = path;

@@ -17,0 +17,0 @@ this.fileName = fileName;

@@ -6,2 +6,3 @@ "use strict";

const uuid = require("uuid");
const guarder_1 = require("guarder");
const Formats_1 = require("./enums/Formats");

@@ -71,2 +72,3 @@ const FileParts_1 = require("./libs/FileParts");

fromDirectory(path, options) {
guarder_1.Guarder.empty(path, 'Path is required', ZipsterError_1.ZipsterError);
const outputLocation = this.getOutputPath(options);

@@ -91,2 +93,4 @@ const createZip = () => {

fromPattern(path, pattern, options) {
guarder_1.Guarder.empty(path, 'Path is required', ZipsterError_1.ZipsterError);
guarder_1.Guarder.empty(pattern, 'Pattern is required', ZipsterError_1.ZipsterError);
const outputLocation = this.getOutputPath(options);

@@ -93,0 +97,0 @@ const globOptions = {

{
"name": "zipster",
"version": "2.1.0",
"version": "2.2.0",
"description": "TypeScript library built for Node backends to create ZIP files with password protection",

@@ -48,5 +48,6 @@ "main": "lib/index.js",

"dependencies": {
"uuid": "3.4.0",
"archiver": "5.3.0",
"archiver-zip-encryptable": "1.0.10"
"archiver-zip-encryptable": "1.0.10",
"guarder": "0.2.0",
"uuid": "3.4.0"
},

@@ -53,0 +54,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

import { FileParts } from '../../../../src/libs/FileParts'
import { FileParts } from '../../../../src'

@@ -15,9 +15,17 @@ describe('FileParts', () => {

describe('#constructor', () => {
it('throws a `ZipsterError` when the path is malformed', () => {
it('throws a `ZipsterError` when missing file extension', () => {
try {
new FileParts('/malformed/path')
} catch (error) {
return error.message.should.deep.equal('Path missing file name or file extension')
return error.message.should.deep.equal('Path missing file extension')
}
})
it('throws a `ZipsterError` when missing file name', () => {
try {
new FileParts('')
} catch (error) {
return error.message.should.deep.equal('Path missing file name')
}
})
})

@@ -24,0 +32,0 @@

@@ -277,2 +277,12 @@ import * as fs from 'fs'

it('rejects with `ZipsterError` when the path is empty', () => {
try {
zipster.fromDirectory(null as any, options)
} catch (error) {
error.should.be.instanceOf(ZipsterError)
error.message.should.deep.equal('Path is required')
return archiver.finalize.should.have.callCount(0)
}
})
it('rejects with `ZipsterError` when an error occurs', () => {

@@ -342,2 +352,22 @@ archiver.finalize

it('rejects with `ZipsterError` when the path is empty', () => {
try {
zipster.fromPattern(null as any, pattern, options)
} catch (error) {
error.should.be.instanceOf(ZipsterError)
error.message.should.deep.equal('Path is required')
return archiver.finalize.should.have.callCount(0)
}
})
it('rejects with `ZipsterError` when the pattern is empty', () => {
try {
zipster.fromPattern(path, null as any, options)
} catch (error) {
error.should.be.instanceOf(ZipsterError)
error.message.should.deep.equal('Pattern is required')
return archiver.finalize.should.have.callCount(0)
}
})
it('rejects with `ZipsterError` when an error occurs finalizing the archive', () => {

@@ -344,0 +374,0 @@ archiver.finalize

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc