2.0.2 • Published 10 months ago
zip-encrypted v2.0.2
zip-encrypted
zip-encrypted is a Node.js library based on Linux commands that supports creating and extracting zip files with passwords.
Installation
npm install zip-encrypted
Usage
makeZip
- Convert JSON data to JSON files and compress those files into a zip file.
const { success, dirPath, zipPath } = await makeZip({
data: [
{
jsonData: {
test1: 'testData1',
test2: 'testData2',
},
jsonName: 'jsonTestName1.json',
},
{
jsonData: {
test1: 'testData3',
test2: 'testData4',
},
jsonName: 'jsonTestName2.json',
},
],
zipPassword: '123',
dirPath: 'C:\\Users\\user\\Desktop\\info\\sam_test_zip',
});
- Compress specified file paths into a zip file.
const { success, dirPath, zipPath } = await makeZip({
filesPath: [
'C:\\Users\\user\\Desktop\\info\\test_zip\\first.json',
'C:\\Users\\user\\Desktop\\info\\test_zip\\second.json',
],
zipPassword: '123',
dirPath: 'C:\\Users\\user\\Desktop\\info\\sam_test_zip',
});
Option Description
Common Request:
- dirPath
- type: string
- Description: Path where the zip file will be created
- Required: Yes
- zipPassword
- type: string
- Description: Password for creating the zip file (if needed)
- Required: No
- dirPath
For compressing JSON data:
- data
- Description: JSON data to be compressed into a zip file
- type:
{
jsonData: { [key: string]: any };
jsonName: string;
}
For compressing already existing files:
- filesPath
- type: string[]
- Description: Paths of the files to be compressed
- filesPath
Common Return:
- success
- type: boolean
- Description: Success status
- error
- type: string
- Description: Error message (if any)
- zipPath
- type: string
- Description: Path of the zip file
- dirPath
- type: string
- Description: Folder of the zip file
- success
unZip
- Download and extract a zip file uploaded on the web.
const { success, error, jsonData } = await unZip({
url: 'https://www.example-zip.com',
zipPassword: '123',
returnJsonYn: true,
});
- Extract an already downloaded zip file.
const { success, error, jsonData } = await unZip({
fileStream: <file stream>,
zipPassword: '123',
returnJsonYn: true,
});
Option Description
Common Request:
- zipPassword
- type: string
- Description: Password for the zip file (if needed)
- Required: No
- returnJsonYn
- type: boolean
- Description: Whether to return JSON data if the extracted file is a JSON file
- Required: No
- zipPassword
For downloading and extracting a zip file uploaded on the web:
- url
- type: string
- Description: URL where the zip file is uploaded
- url
For extracting an already downloaded zip file:
- fileStream
- type: any
- Description: stream of the zip file
- fileStream
Common Return:
- success
- type: boolean
- Description: Success status
- error
- type: string
- Description: Error message (if any)
- dirPath
- type: string
- Description: Folder of the zip file
- jsonData
- type: json
- Description: Data of the JSON file contained in the zip file (if returnJsonYn is true)
- success
Keywords
zip zip encrypt zip-encrypt zip encrypted zip-encrypted unzip unzip encrypt unzip-encrypt unzip encrypted unzip-encrypted Installation bash
1.2.0
10 months ago
1.2.4
10 months ago
1.2.3
10 months ago
1.2.2
10 months ago
1.2.1
10 months ago
2.0.2
10 months ago
2.0.1
10 months ago
2.0.0
10 months ago
1.1.1
1 year ago
1.1.0
1 year ago
1.0.11
1 year ago
1.0.10
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago