@d-zero/fs
v0.2.2
Published
File system utilities
Readme
@d-zero/fs
@d-zero/fs provides file system utilities for working with zip archives.
Features
zip(outputFilePath: string, targetDir: string): Promise Compresses the contents of a target directory into a zip archive saved at the specified output file path.
unzip(zipFilePath: string, targetDir: string): Promise Extracts the contents of a zip archive into the specified directory.
extractZip(zipFilePath: string): Promise<unzipper.Open.File> Opens a zip file and returns an object representing the archive using the
unzipperlibrary.
Installation
npm install @d-zero/fsUsage
Since the package uses ES modules, import the functions from the subpath "@d-zero/fs/zip".
import { zip } from '@d-zero/fs/zip';
await zip('path/to/archive.zip', 'path/to/targetDir');import { unzip } from '@d-zero/fs/zip';
await unzip('path/to/archive.zip', 'path/to/extractDir');import { extractZip } from '@d-zero/fs/zip';
const directory = await extractZip('path/to/archive.zip');
console.log(directory.files); // List of files in the archive