是否可以在“节点”和“ hls.js”中使用“流”模块? (电子应用程序-使用主进程和渲染进程) 我想做的是,我想下载mp3文件并加密它们,然后解密然后播放! 但是我不想在解密后创建新文件,我想知道可以用hlsjs做些什么吗?
const fs = require('fs');
const readStream = fs.createReadStream('./a.mp3');
// I don't want to create b.mp3
// I want to parse it directly and pass it to hls.js
const writeStream = fs.createWriteStream('./b.mp3');
readStream.on('data', (chunk) => {
// Can i pass this chunk to hls.js?
console.log('chunk', chunk);
writeStream.write(chunk);
});
如果不可能, 我可以使用nodejs在内存中创建临时文件吗?