diff --git a/lib/index.js b/lib/index.js index feb0206..68de2c5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,6 +1,5 @@ const async = require('async') const fs = require('fs') -const mkdirp = require('mkdirp') const path = require('path') const gifsicle = require('./image/gifsicle') const gmagick = require('./image/gmagick') @@ -18,7 +17,7 @@ const DEFAULT_STILL_SEEK_SECONDS = 1 */ exports.image = function (source, target, options, callback) { // create target folder if needed - mkdirp.sync(path.dirname(target)) + fs.mkdirSync(path.dirname(target), { recursive: true }) // when processing a GIF // - if asking for an animated target, process with Gifsicle @@ -49,7 +48,7 @@ exports.image = function (source, target, options, callback) { exports.video = function (source, target, options, callback) { // create target folder if needed - mkdirp.sync(path.dirname(target)) + fs.mkdirSync(path.dirname(target), { recursive: true }) // run ffmpeg to create the downsized video const args = ffargs.prepare(source, target, options) @@ -61,7 +60,8 @@ exports.video = function (source, target, options, callback) { */ exports.still = function (source, target, options, callback) { // create target folder if needed - mkdirp.sync(path.dirname(target)) + fs.mkdirSync(path.dirname(target), { recursive: true }) + async.series([ (next) => extractFrame(source, target, options, next), (next) => exports.image(target, target, options, next) diff --git a/package-lock.json b/package-lock.json index 1641529..91734a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,6 @@ "async": "^3.2.4", "debug": "^4.3.4", "gm": "^1.25.0", - "mkdirp": "^2.1.5", "split": "^1.0.1", "tmp": "^0.2.1" }, @@ -2406,20 +2405,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mkdirp": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.5.tgz", - "integrity": "sha512-jbjfql+shJtAPrFoKxHOXip4xS+kul9W3OzfzzrqueWK2QMGon2bFH2opl6W9EagBThjEz+iysyi/swOoVfB/w==", - "bin": { - "mkdirp": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/mocha": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", diff --git a/package.json b/package.json index 596e4ad..d89f063 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "async": "^3.2.4", "debug": "^4.3.4", "gm": "^1.25.0", - "mkdirp": "^2.1.5", "split": "^1.0.1", "tmp": "^0.2.1" },