ptSend/util/utils.js
2023-06-14 22:12:10 +08:00

27 lines
619 B
JavaScript

const { spawn } = require('child_process');
function seep(time){
return new Promise((res)=>{
setTimeout(()=>{
res()
},time)
})
}
function dow(info,callback){
const lux = spawn("./bin/yt-dlp.exe", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url])
lux.stdout.on('data', (data) => {
console.log(String(data))
callback(String(data),false)
});
lux.on('close', (code) => {
console.log("结束")
callback(code,true)
});
}
module.exports = {
seep,
dow
}