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.
Files changed (2) hide show
  1. package/index.mjs +10 -2
  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?.toLowerCase().split('.').at(-1) ?? '';
772
+ return getExtension(this.#fileName);
765
773
  }
766
774
 
767
775
  getContentTypeByExtension() {
768
- return mimeTypes[this.getExtension()] ?? 'application/octet-stream';
776
+ return getContentTypeByExtension(this.#fileName);
769
777
  }
770
778
 
771
779
  getFileName() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimalistic-server",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "engines" : {
5
5
  "npm" : ">=8.6.0",
6
6
  "node" : ">=22.0.0"