https://github.com/singcl/concat
concat files based on Stream in node js
https://github.com/singcl/concat
concat nodejs typescript
Last synced: 5 months ago
JSON representation
concat files based on Stream in node js
- Host: GitHub
- URL: https://github.com/singcl/concat
- Owner: singcl
- Created: 2018-05-08T05:59:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-12T09:59:02.000Z (over 7 years ago)
- Last Synced: 2025-01-03T13:17:48.998Z (about 1 year ago)
- Topics: concat, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nodejs 基于Stream 的文件合并模块
利用该模块可以很方便的将分片上传的多个chunk合并成一个文件。
[](https://www.npmjs.com/package/@singcl/concat)




## Install
```sh
npm i @singcl/concat -S
```
## API
### contact
#### contact(srcDir, destination,callback)
| 参数 | 数据类型 | 参数描述 |
|:-----:|:-------:|:--------|
| srcDir| String |资源目录。需要合并的文件所在的目录路径|
| destination| String |目标文件。最终合并成的文件路径|
| callback| Function |合并成功或者失败的回调函数|
- callback 回调函数
- err callback的唯一参数,没有错误时候该参数值为null
**Example:**
*The example Dir is like this:*

```js
var concat = require('@singcl/concat')
var targetDir = './txt'
var dest = './data'
// 将txt 目录下所有文件合并为一个名为data的无扩展名的文件
concat(targetDir, dest, function(err) {
if (err) return console.error('ERROR:', err)
console.log('完成')
})
```