Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(err, stdoutRing) => {
if (err) {
reject(err);
}
let stdout = stdoutRing.get();
let lines = [
...new Set(
stdout
.replace("Hardware acceleration methods:", "")
.replace(/\n/g, " ")
.trim()
.split(" ")
)
];
ffmpeg.getAvailableEncoders((err, encoders) => {
if (err) {
reject(err);
}
let reslut = lines.reduce((total, it) => {
return total.concat(
Object.keys(encoders).filter(encodersName =>
encodersName.includes(it)
)
);
}, []);
resolve(reslut);
});
}
);
async (req, res, next) => {
try {
const promisify = (fn) =>
new Promise((resolve, reject) =>
fn((err, data) => err ? reject(err) : resolve(data)));
const [
formats, codecs, encoders, filters, postcount, boardcount, spaceused
] = await Promise.all([
promisify(ffmpeg.getAvailableFormats),
promisify(ffmpeg.getAvailableCodecs),
promisify(ffmpeg.getAvailableEncoders),
promisify(ffmpeg.getAvailableFilters),
Post.estimatedDocumentCount(),
Board.estimatedDocumentCount(),
new Promise((resolve, reject) => {
du(config.html_path, (err, size) => {
if (err) {
reject(err);
return;
}
resolve(size);
});
}),
]);
const ffmpegPath = process.env.FFMPEG_PATH;
const ffprobePath = process.env.FFPROBE_PATH;