fs.project
@listenai/lisa_core / Exports / fs / Project
Class: Project
fs.Project
项目类,用于快捷创建项目结构
#
Table of contents#
Constructors#
Properties#
Accessors#
Methods#
Constructors#
constructor• new Project()
#
Defined in#
Properties#
_download_path• Private
Optional
_download_path: string
template 目录
#
Defined in#
_root• Private
Optional
_root: string
项目主目录
#
Defined in#
_template_path• Private
Optional
_template_path: string
template 目录
#
Defined in#
error• error: LogFunction
错误日志方法
#
Defined in#
info• info: LogFunction
日志方法
#
Defined in#
Accessors#
download_path• get
download_path(): string
#
Returnsstring
#
Defined in• set
download_path(dir
): void
#
ParametersName | Type |
---|---|
dir | string |
#
Returnsvoid
#
Defined in#
root• get
root(): string
#
Returnsstring
#
Defined in• set
root(dir
): void
#
ParametersName | Type |
---|---|
dir | string |
#
Returnsvoid
#
Defined in#
template_path• get
template_path(): string
#
Returnsstring
#
Defined in• set
template_path(dir
): void
#
ParametersName | Type |
---|---|
dir | string |
#
Returnsvoid
#
Defined in#
Methods#
copy▸ copy(source
, target
): Promise
<void
>
文件复制 or 目录复制
#
ParametersName | Type | Description |
---|---|---|
source | string | 模版地址,注意是在项目设置的模版目录中寻找 |
target | string | 目标地址,注意是在项目中对应的地址 |
#
ReturnsPromise
<void
>
#
Defined in#
downloadFile▸ downloadFile(opts
): Promise
<Object
>
下载文件
#
ParametersName | Type |
---|---|
opts | Object |
opts.fileName | string |
opts.progress? | (percentage : number , transferred : number , total : number ) => void |
opts.targetDir? | string |
opts.url | string |
#
ReturnsPromise
<Object
>
#
Defined in#
download_join▸ download_join(...paths
): string
获取下载路径
#
ParametersName | Type | Description |
---|---|---|
...paths | string [] | 路径地址 |
#
Returnsstring
#
Defined in#
join▸ join(...paths
): string
获取项目的对应目录
#
ParametersName | Type | Description |
---|---|---|
...paths | string [] | 路径地址 |
#
Returnsstring
#
Defined in#
mkdir▸ mkdir(...paths
): Promise
<void
>
创建目录
#
ParametersName | Type | Description |
---|---|---|
...paths | string [] | 目录路径,请注意,这是里相对路径 |
#
ReturnsPromise
<void
>
#
Defined in#
template▸ template(source
, target
, data
): Promise
<void
>
模版渲染器
#
ParametersName | Type | Description |
---|---|---|
source | string | 模版地址,注意是在项目设置的模版目录中寻找 |
target | string | 目标地址,注意是在项目中对应的地址 |
data | any | - |
#
ReturnsPromise
<void
>
#
Defined in#
template_join▸ template_join(...paths
): string
获取模板路径
#
ParametersName | Type | Description |
---|---|---|
...paths | string [] | 路径地址 |
#
Returnsstring
#
Defined in#
touch▸ touch(...paths
): Promise
<void
>
创建空白文件
#
ParametersName | Type |
---|---|
...paths | string [] |
#
ReturnsPromise
<void
>
#
Defined in#
unzip▸ unzip(source
, target?
): Promise
<void
>
解压文件
#
ParametersName | Type | Description |
---|---|---|
source | string | zip文件地址 |
target? | string | 解压目录 |
#
ReturnsPromise
<void
>
#
Defined in#
zip▸ zip(): AdmZip
获取zip实例
#
ReturnsAdmZip