-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodeScript.js
48 lines (41 loc) · 2.96 KB
/
nodeScript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require('path')
const readlineSync = require('readline-sync')
const tinypng = require('./tinypng')
const args = process.argv.splice(2)
let filePath = args.reduce((arr, file) => {
arr.push(path.resolve(file.replace(/\\/g, '\\\\')))
return arr
}, [])
console.log(filePath)
console.log(`
75808880888088888888808080888880888080808880866495954445459444444495449495449545444444944217
78880277 508080888080808880888088888080808080808888808080801
7885 78069696969696969696969696969696969696969696969008086
807 7004949494949966099499949494999494999499999464946966886
780 8694999994946080899964996969999494999900808969949969008
89 1 787 08994999999601 9868080888886699966808007208999949499008
88 87 7 886994999496857780098880419888696080557 7 28999949499008
10 7909197 271 7527712507 552117 711557 989949994969 687 780008 21 469494999499007
08 07 07 787 06 60 02 20649499996660 00007 78087 888 78087 58069949499949984
85 07 07 70 78 87 78 78994949999608 08082 88888 5887 7880 10699499999494900
05 87 7 07 78 70 78 8 70699494999488 80602 7886807 507 7 500999999494949988
86 07 78 07 70 78 41 67 78669999964908 88981 80888 88 157718080949494949494686
88 987787 77857 75877 7507 699 0899999608688 80002 777 5808 78064999494949682
707 717 77777 777 77 77777 20 8099946042808 88885 74 70808 0808887 89999994996980
68 787 70 88999998 187 8057 480808900 7777 186994949999001
80 11291 006499901 78887 7 78969698047 7886994949999886
807 589949960809080698880808964949900808880806999949466805
7887 70649499668089649966696964999999696909699999696680887
18807 80696966696969666966696969696666696969660600888087
75808089454545454545454545454545454545454545454551908080888080888880888880888880888080808088808897
`)
if (filePath.length === 0) {
console.log('请输入文件路径(可逗号分隔多路径,默认为当前文件夹)')
const files = readlineSync.question('> ') || './'
filePath = files.split(',').reduce((arr, file) => {
file && arr.push(path.resolve(file.trim()))
return arr
}, filePath)
}
// filePath.length === 0 && filePath.push(path.resolve('./'))
tinypng(filePath)