@guanghechen/helper-file
v5.0.7
Published
File helper
Downloads
94
Maintainers
Readme
A collection of utility functions for handling files, such as split big file or merge multiple small files.
Install
npm
npm install --save @guanghechen/helper-file
yarn
yarn add @guanghechen/helper-file
Usage
BigFileHelper
(inspired by split-file)import { bigFileHelper, calcFilePartItemsBySize } from '@guanghechen/helper-file' 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
:----------------------------------:|:----------------------------:
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
calcFilePartNames
| Generate file part names (suffix)