mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
14 lines
434 B
JavaScript
14 lines
434 B
JavaScript
|
import { readFileSync, readdirSync, writeFileSync } from 'fs'
|
||
|
import { createHash } from 'crypto'
|
||
|
const files = readdirSync('dist')
|
||
|
|
||
|
for (const file of files) {
|
||
|
for (const ext of process.argv.slice(2)) {
|
||
|
if (file.endsWith(ext)) {
|
||
|
const content = readFileSync(`dist/${file}`)
|
||
|
const checksum = createHash('sha256').update(content, 'utf8').digest('hex')
|
||
|
writeFileSync(`dist/${file}.sha256`, checksum)
|
||
|
}
|
||
|
}
|
||
|
}
|