NodeJs Express usa transmisiones
const fs = require("fs"),
tar = require("tar-stream");
app.get("/fileFromTar/*", (req, res) => {
const fileWanted = req.params[0],
readStream = fs.createReadStream('myTarFile.tar'),
extractor = tar.extract();
extractor.on('entry', (header, stream, next) => {
stream.on('end', next);
if (header.name === fileWanted) {
const { size } = header;
res.set({
"Content-Type": 'audio/flac', // or whichever one applies
"Content-Length": size,
"Content-Range": `bytes 0-${size}/${size}`
});
stream.pipe(res);
}
else stream.resume();
});
readStream.pipe(extractor);
});
Foolish Ferret