UNPKG

@licq/tpkg

Version:

pack or unpack wechatapp and qqminiapp package

79 lines (55 loc) 2.1 kB
# @licq/tpkg pack or unpack `wechatapp(.wxvpkg)` and `qqminiapp(.tqapkg)` package. [![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url] [npm-image]: http://img.shields.io/npm/v/@licq/tpkg.svg?style=flat-square [npm-url]: http://npmjs.org/package/@licq/tpkg [download-image]: https://img.shields.io/npm/dm/@licq/tpkg.svg?style=flat-square [download-url]: https://npmjs.org/package/@licq/tpkg ## Install ```js npm i --save @licq/tpkg ``` ## API ### pack 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 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/** ``` ## CLI ```sh npm i -g @licq/tpkg # unpack tpkg path/to/demo.wxvpkg # unpack to path/to/* tpkg path/to/demo.tqapkg # unpack to path/to/* tpkg path/to/demo.wxvpkg path/to/target # unpack to path/to/target/* # pack tpkg path/to/demo # pack to path/to/demo.wxvpkg tpkg path/to/demo path/to/target # pack to path/to/target/demo.wxvpkg tpkg path/to/demo path/to/target demo.tqapkg # pack to path/to/target/demo.tqapkg ```