MCPcopy Create free account
hub / github.com/AS-AIGC/TranscriptHub / is_media_file_callback

Function is_media_file_callback

apps/backend/utils.js:73–84  ·  view source on GitHub ↗

* @brief Check if file is a supported media type (callback version) * * @param file_path [in] Path to media file to check * @param callback [in] Function(err, is_media) * - err: Error object if operation failed * - is_media: Boolean indicating if file is supported * * Supported Ty

(file_path, callback)

Source from the content-addressed store, hash-verified

71 * @note Checks both file existence and MIME type
72 */
73function is_media_file_callback(file_path, callback) {
74 fs.access(file_path, (err) => {
75 if (err) {
76 logger(LOG_LEVEL.ERROR, `Error accessing audio source file ${err.message}`);
77 return callback(null, false);
78 }
79
80 const mime_type = mime.lookup(file_path);
81
82 callback(null, cfg.media_mime_types.includes(mime_type));
83 });
84}
85
86/**
87 * @brief Get media file duration and metadata (callback version)

Callers 1

Calls 1

loggerFunction · 0.85

Tested by

no test coverage detected