minimalistic-server 0.0.50 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +10 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -741,6 +741,14 @@ export function setServerFsPromiseModule(fsPromiseModule) {
|
|
|
741
741
|
clearStaticCache();
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
+
export function getExtension(fileNameOrPath) {
|
|
745
|
+
return fileNameOrPath?.toLowerCase().split('.').at(-1) ?? '';
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export function getContentTypeByExtension(fileNameOrPath) {
|
|
749
|
+
return mimeTypes[getExtension(fileNameOrPath)] ?? 'application/octet-stream';
|
|
750
|
+
}
|
|
751
|
+
|
|
744
752
|
export class UploadedFile {
|
|
745
753
|
#content;
|
|
746
754
|
#contentType;
|
|
@@ -761,11 +769,11 @@ export class UploadedFile {
|
|
|
761
769
|
}
|
|
762
770
|
|
|
763
771
|
getExtension() {
|
|
764
|
-
return this.#fileName
|
|
772
|
+
return getExtension(this.#fileName);
|
|
765
773
|
}
|
|
766
774
|
|
|
767
775
|
getContentTypeByExtension() {
|
|
768
|
-
return
|
|
776
|
+
return getContentTypeByExtension(this.#fileName);
|
|
769
777
|
}
|
|
770
778
|
|
|
771
779
|
getFileName() {
|