今天写个小玩意的时候,需要做大量的转换。
需要将
export interface TrFile {
// 下面是从文档上直接 copy 下来的
"cookies" | string pointer to a string of one or more cookies.
"download-dir" | string path to download the torrent to
"filename" | string filename or URL of the .torrent file
"metainfo" | string base64-encoded .torrent content
"paused" | boolean if true, don't start the torrent
"peer-limit" | number maximum number of peers
"bandwidthPriority" | number torrent's bandwidth tr_priority_t
"files-wanted" | array indices of file(s) to download
"files-unwanted" | array indices of file(s) to not download
"priority-high" | array indices of high-priority file(s)
"priority-low" | array indices of low-priority file(s)
"priority-normal" | array indices of normal-priority file(s)
}
转换成:
export interface TrFile {
// 下面是转换后的
"cookies": string // pointer
"download-dir": string // path
"filename": string // filename
"metainfo": string // base64-encoded
"paused": boolean // if
"peer-limit": number // maximum
"bandwidthPriority": number // torrent's
"files-wanted": array // indices
"files-unwanted": array // indices
"priority-high": array // indices
"priority-low": array // indices
"priority-normal": array // indices
}
找了半天没有合适的工具, 因此自己撸了一个插件来调用自定义函数对选中文件进行修改。
插件地址: https://marketplace.visualstudio.com/items?itemName=kleshwong.selection-converter