mirror of
https://github.com/appium/appium.git
synced 2026-02-20 18:30:11 -06:00
fix(support): Require the optional sharp dep properly from mjpeg module (#18769)
This commit is contained in:
@@ -3,7 +3,7 @@ let _sharp;
|
||||
/**
|
||||
* @returns {import('sharp')}
|
||||
*/
|
||||
function requireSharp() {
|
||||
export function requireSharp() {
|
||||
if (!_sharp) {
|
||||
try {
|
||||
_sharp = require('sharp');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _ from 'lodash';
|
||||
import log from './logger';
|
||||
import B from 'bluebird';
|
||||
import sharp from 'sharp';
|
||||
import {requireSharp} from './image-util';
|
||||
import {Writable} from 'stream';
|
||||
import {requirePackage} from './node';
|
||||
import axios from 'axios';
|
||||
@@ -77,7 +77,7 @@ class MJpegStream extends Writable {
|
||||
}
|
||||
|
||||
try {
|
||||
return await sharp(lastChunk).png().toBuffer();
|
||||
return await requireSharp()(lastChunk).png().toBuffer();
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user