1.9.8 • Published 2 years ago
@guanghechen/file-helper v1.9.8
A collection of utility functions for handling files, such as split big file or merge multiple small files.
Install
npm
npm install --save @guanghechen/file-helper
yarn
yarn add @guanghechen/file-helper
Usage
BigFileHelper
(inspired by split-file)import { bigFileHelper, calcFilePartItemsBySize, } from '@guanghechen/file-helper' async function splitFile(filepath: string): Promise<string[]> { const parts = calcFilePartItemsBySize(filepath, 1024 * 1024 * 80) // 80MB per chunk const partFilepaths: string[] = await bigFileHelper.split(filepath, parts) return partFilepaths } splitFile('big-file.txt')
Overview
Name | Description |
---|---|
absoluteOfWorkspace | Calc absolute path of p under the workspace |
BigFileHelper | A utility class for split / merging big files |
bigFileHelper | Default instance of BigFleHelper |
calcFilePartItemsBySize | Generate file part items by part size |
calcFilePartItemsByCount | Generate file part items by total of parts |
collectAllFiles | Collect all files under the given directory |
collectAllFilesSync | Collect all files under the given directory (synchronizing) |
consumeStreams | Consume multiple streams serially |
ensureCriticalFilepathExistsSync | Ensure critical filepath exists |
isDirectorySync | Check whether if the dirpath is a directory path |
isFileSync | Check whether if the filepath is a file path |
isNonExistentOrEmpty | Check whether if the dirPath is a non-existent path or empty folder |
mkdirsIfNotExists | Create a path of directories |
relativeOfWorkspace | Calc relative path to workspace |
1.9.8
2 years ago
1.9.7
2 years ago
1.9.6
2 years ago
1.9.5
2 years ago
1.9.0-alpha.0
2 years ago
1.9.1
2 years ago
1.9.0
2 years ago
1.8.6
2 years ago
1.9.4
2 years ago
1.9.3
2 years ago
1.9.2
2 years ago
1.8.5
2 years ago
1.8.4
3 years ago
1.8.3
3 years ago
1.8.2
3 years ago
1.8.1
3 years ago
1.8.0
3 years ago
1.7.1
3 years ago
1.7.0
3 years ago
1.7.0-alpha.3
3 years ago
1.7.0-alpha.2
3 years ago
1.7.0-alpha.1
3 years ago
1.7.0-alpha.0
3 years ago