File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/Nether/Common/Filesystem Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,26 @@ static public function
311311 #[Common \Date('2024-06-21 ' )]
312312 static public function
313313 MimeType (string $ Filename ):
314+ string {
315+
316+ return static ::FileMimeType ($ Filename );
317+ }
318+
319+ static public function
320+ FileExtension (string $ Filename ):
321+ ?string {
322+
323+ if (str_contains ($ Filename , '. ' ))
324+ return strtolower (substr (
325+ $ Filename ,
326+ (strrpos ($ Filename , '. ' ) + 1 )
327+ ));
328+
329+ return NULL ;
330+ }
331+
332+ static public function
333+ FileMimeType (string $ Filename ):
314334 string {
315335
316336 $ Type = mime_content_type ($ Filename );
@@ -323,6 +343,16 @@ static public function
323343 return 'application/octet-stream ' ;
324344 }
325345
346+ static public function
347+ FileMimeExtension (string $ Type ):
348+ string {
349+
350+ $ FileEye = new FileEye \MimeMap \Type ($ Type );
351+ $ Ext = $ FileEye ->GetDefaultExtension ();
352+
353+ return $ Ext ;
354+ }
355+
326356 static public function
327357 TryToReadFile (string $ Filename ):
328358 string {
You can’t perform that action at this time.
0 commit comments