Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
save(file, readStream, cb) {
debug('save', file)
if (file.metadata.secure && (!file.crypto.algorithm || !file.crypto.passphrase)) {
return cb('You did not provide a valid crypto algorithm and/or passphrase.')
}
detectMime(readStream, (err, mime, dataStream) => {
if (err) {
return cb(err)
}
// set default mime value if libmagic fails
if (mime === null) {
mime = { type: 'application/octet-stream' }
}
// perform additional lookup when mime type is text/plain
mime.type = mime.type === 'text/plain'
? mimeType.lookup(file.filename) || 'text/plain'
: mime.type
// detect if file is blacklisted
const { blacklist } = this._storageConfig
save(file, readStream, cb) {
debug('save', file)
if (file.metadata.secure && (!file.crypto.algorithm || !file.crypto.passphrase)) {
return cb('You did not provide a valid crypto algorithm and/or passphrase.')
}
detectMime(readStream, (err, mime, dataStream) => {
if (err) {
return cb(err)
}
// set default mime value if libmagic fails
if (mime === null) {
mime = { type: 'application/octet-stream' }
}
// perform additional lookup when mime type is text/plain
mime.type = mime.type === 'text/plain'
? mimeType.lookup(file.filename) || 'text/plain'
: mime.type
// detect if file is blacklisted
const { blacklist } = this._storageConfig
var _ = require("underscore");
var path = require("path");
var VideoConverter = require("./VideoConverter.js");
var Stream = require('stream');
var magic = require('stream-mmmagic');
magic.config.magicFile = "(null),"+path.join(__dirname,"../misc/magic");
var presets = require("./presets.js");
/**
*
*
* @param options configuration options
* @param options.ffmpeg {String} path to ffmpeg
* @param options.im {String} path to imagemagick
* @constructor
*/
function MediaConverter(options) {
options = _.defaults(options || {}, {
programs: {
// Path to the ffmpeg program
ffmpeg: 'ffmpeg',