@licq/tpkg
Version:
pack or unpack wechatapp and qqminiapp package
79 lines (55 loc) • 2.1 kB
Markdown
pack or unpack `wechatapp(.wxvpkg)` and `qqminiapp(.tqapkg)` package.
[![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url]
[]: http://img.shields.io/npm/v/@licq/tpkg.svg?style=flat-square
[]: http://npmjs.org/package/@licq/tpkg
[]: https://img.shields.io/npm/dm/@licq/tpkg.svg?style=flat-square
[]: https://npmjs.org/package/@licq/tpkg
```js
npm i --save @licq/tpkg
```
pack dir to pkg
**Returns**: pathLike
**Since**: v1.0.0
| Param | Type | Description |
| --- | --- | --- |
| sourceDir | <code>pathLike</code> | [required] The directory to work with |
| targetPath | <code>pathLike</code> | [optional] The target path, The default path is the same as the sourceDir. |
| targetName | <code>string</code> | [optional] The target filename, The default name is the same as the sourceDir. |
**Example**
```js
const tpkg = require('@licq/tpkg')
const res = tpkg.pack('path/to/dir/');
const res = tpkg.pack('path/to/dir/', 'path/to/dir/demo');
const res = tpkg.pack('path/to/dir/', 'path/to/dir/demo', 'demo.wxvpkg') // or demo.tqapkg
//==> eg: path/to/dir/demo.wxvpkg
```
unpack pkg
**Returns**: pathLike
**Since**: v1.0.0
| Param | Type | Description |
| --- | --- | --- |
| pkgPath | <code>pathLike</code> | [required] The pkgPath to work with |
| targetPath | <code>pathLike</code> | [optional] The target path, The default is the same as the pkgPath. |
**Example**
```js
const tpkg = require('@licq/tpkg')
const res = tpkg.unpack('path/to/dir/demo.wxvpkg', _dirname) // or demo.tqapkg
//==> eg: ${_dirname}/demo/**
```
```sh
npm i -g @licq/tpkg
tpkg path/to/demo.wxvpkg
tpkg path/to/demo.tqapkg
tpkg path/to/demo.wxvpkg path/to/target
tpkg path/to/demo
tpkg path/to/demo path/to/target
tpkg path/to/demo path/to/target demo.tqapkg
```