Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ensure-ffmpeg

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ensure-ffmpeg - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

27

index.js

@@ -8,10 +8,23 @@ const fs = require('fs-extra');

function removeFFMPEGFolder(tempFolder) {
let files = fs.readdirSync(tempFolder);
files.filter(file => file.startsWith('ffmpeg-')).forEach(file => fs.removeSync(path.join(tempFolder, file)));
if (fs.existsSync(tempFolder)) {
let files = fs.readdirSync(tempFolder);
files.filter(file => file.startsWith('ffmpeg-')).forEach(file => fs.removeSync(path.join(tempFolder, file)));
}
}
function ensureFFMPEG(tempFolder, ffmpegPath) {
ffmpegPath = ffmpegPath || path.join(__dirname, 'ffmpeg.exe');
tempFolder = tempFolder || path.join(__dirname, 'temp');
/**
* Ensure ffmpeg utility is available in root folder
* @param {string} rootPath Root path of executing folder, default: __dirname
* @param {string} tempFolder Temporary folder for downloads, default: 'temp' (will be cleared)
*/
function ensureFFMPEG(rootPath, tempFolder) {
rootPath = rootPath ||
__dirname.endsWith('node_modules\\ensure-ffmpeg') || __dirname.endsWith('node_modules/ensure-ffmpeg') ?
__dirname.substr(0, __dirname.length - 'node_modules/ensure-ffmpeg'.length) :
__dirname;
ffmpegPath = ffmpegPath || path.join(rootPath, 'ffmpeg.exe');
tempFolder = tempFolder || path.join(rootPath, 'temp');
if (!fs.existsSync(ffmpegPath)) {

@@ -21,3 +34,3 @@

download(downloadUrl, tempFolder, { extract: true, filename: 'ffmpeg' })
return download(downloadUrl, tempFolder, { extract: true, filename: 'ffmpeg' })
.then(() => {

@@ -37,4 +50,6 @@ let files = fs.readdirSync(tempFolder);

}
return new Promise.resolve();
}
module.exports = { ensureFFMPEG }
{
"name": "ensure-ffmpeg",
"version": "1.0.0",
"version": "1.0.1",
"description": "Ensure ffmpeg is avialable on the local environment",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc