@spinajs/fs
Advanced tools
Comparing version 2.0.290 to 2.0.291
@@ -227,3 +227,3 @@ /// <reference types="node" /> | ||
* | ||
* Compress specified file or dir in provided path. If | ||
* Compress specified file or dir in provided path. | ||
* Dir is compressed recursively | ||
@@ -234,3 +234,3 @@ * | ||
*/ | ||
static zip(path: string, dstFs?: fs, dstFile?: string): Promise<IZipResult>; | ||
static zip(path: string | string[], dstFile?: string, dstFs?: fs): Promise<IZipResult>; | ||
/** | ||
@@ -237,0 +237,0 @@ * Decompress given file to destination path |
@@ -11,3 +11,3 @@ "use strict"; | ||
if (!reg.test(path)) { | ||
throw new exceptions_1.InvalidArgument(`path is not valid filesystem URI`); | ||
return [null, path]; | ||
} | ||
@@ -167,3 +167,3 @@ const args = reg.exec(path)[2].split('/'); | ||
* | ||
* Compress specified file or dir in provided path. If | ||
* Compress specified file or dir in provided path. | ||
* Dir is compressed recursively | ||
@@ -174,6 +174,7 @@ * | ||
*/ | ||
static zip(path, dstFs, dstFile) { | ||
const [fs, p] = uriToFs(path); | ||
static zip(path, dstFile, dstFs) { | ||
const [fs] = !Array.isArray(path) ? uriToFs(path) : uriToFs(path[0]); | ||
const [dFs, fP] = uriToFs(dstFile); | ||
return fs.zip(p, dFs ?? dstFs, fP); | ||
const files = Array.isArray(path) ? path.map((x) => uriToFs(x)[1]) : uriToFs(path)[1]; | ||
return fs.zip(files, dFs ?? dstFs, fP ?? dstFile); | ||
} | ||
@@ -180,0 +181,0 @@ /** |
@@ -227,3 +227,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
* | ||
* Compress specified file or dir in provided path. If | ||
* Compress specified file or dir in provided path. | ||
* Dir is compressed recursively | ||
@@ -234,3 +234,3 @@ * | ||
*/ | ||
static zip(path: string, dstFs?: fs, dstFile?: string): Promise<IZipResult>; | ||
static zip(path: string | string[], dstFile?: string, dstFs?: fs): Promise<IZipResult>; | ||
/** | ||
@@ -237,0 +237,0 @@ * Decompress given file to destination path |
/* eslint-disable security/detect-non-literal-fs-filename */ | ||
import { AsyncService, DI } from '@spinajs/di'; | ||
import { InvalidArgument, IOFail } from '@spinajs/exceptions'; | ||
import { IOFail } from '@spinajs/exceptions'; | ||
import { v4 as uuidv4 } from 'uuid'; | ||
@@ -8,3 +8,3 @@ function uriToFs(path) { | ||
if (!reg.test(path)) { | ||
throw new InvalidArgument(`path is not valid filesystem URI`); | ||
return [null, path]; | ||
} | ||
@@ -164,3 +164,3 @@ const args = reg.exec(path)[2].split('/'); | ||
* | ||
* Compress specified file or dir in provided path. If | ||
* Compress specified file or dir in provided path. | ||
* Dir is compressed recursively | ||
@@ -171,6 +171,7 @@ * | ||
*/ | ||
static zip(path, dstFs, dstFile) { | ||
const [fs, p] = uriToFs(path); | ||
static zip(path, dstFile, dstFs) { | ||
const [fs] = !Array.isArray(path) ? uriToFs(path) : uriToFs(path[0]); | ||
const [dFs, fP] = uriToFs(dstFile); | ||
return fs.zip(p, dFs ?? dstFs, fP); | ||
const files = Array.isArray(path) ? path.map((x) => uriToFs(x)[1]) : uriToFs(path)[1]; | ||
return fs.zip(files, dFs ?? dstFs, fP ?? dstFile); | ||
} | ||
@@ -177,0 +178,0 @@ /** |
{ | ||
"name": "@spinajs/fs", | ||
"version": "2.0.290", | ||
"version": "2.0.291", | ||
"description": "wrapper for file operations", | ||
@@ -55,5 +55,5 @@ "main": "lib/cjs/index.js", | ||
"dependencies": { | ||
"@spinajs/exceptions": "2.0.290", | ||
"@spinajs/util": "2.0.290", | ||
"@spinajs/log-common": "2.0.290", | ||
"@spinajs/exceptions": "2.0.291", | ||
"@spinajs/util": "2.0.291", | ||
"@spinajs/log-common": "2.0.291", | ||
"archiver": "^5.3.1", | ||
@@ -60,0 +60,0 @@ "lodash": "^4.17.21", |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
329095
2855
+ Added@spinajs/exceptions@2.0.291(transitive)
+ Added@spinajs/log-common@2.0.291(transitive)
+ Added@spinajs/util@2.0.291(transitive)
- Removed@spinajs/exceptions@2.0.290(transitive)
- Removed@spinajs/log-common@2.0.290(transitive)
- Removed@spinajs/util@2.0.290(transitive)
Updated@spinajs/exceptions@2.0.291
Updated@spinajs/log-common@2.0.291
Updated@spinajs/util@2.0.291