ilhamdev commited on
Commit
04c5d14
·
verified ·
1 Parent(s): caf073a

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +113 -1
index.js CHANGED
@@ -821,6 +821,118 @@ try {
821
  const file = File.fromURL(url);
822
  await file.loadAttributes();
823
  let data = await file.downloadBuffer();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  let {fileTypeFromBuffer} = await (await import('file-type'))
825
  return res.json({
826
  message:"Success",
@@ -834,7 +946,7 @@ result : {name: file.name,
834
  })
835
  } catch (e) {
836
  console.log(e);
837
- return res.json({ message: e.message,
838
  code: 500
839
  });
840
  }
 
821
  const file = File.fromURL(url);
822
  await file.loadAttributes();
823
  let data = await file.downloadBuffer();
824
+ mime.types['py'] = 'text/x-python'; // Python
825
+ mime.types['java'] = 'text/x-java-source'; // Java
826
+ mime.types['c'] = 'text/x-c'; // C
827
+ mime.types['cpp'] = 'text/x-c++src'; // C++
828
+ mime.types['cc'] = 'text/x-c++src'; // C++
829
+ mime.types['cxx'] = 'text/x-c++src'; // C++
830
+ mime.types['cs'] = 'text/x-csharp'; // C#
831
+ mime.types['php'] = 'application/x-httpd-php'; // PHP
832
+ mime.types['rb'] = 'text/x-ruby'; // Ruby
833
+ mime.types['pl'] = 'text/x-perl'; // Perl
834
+ mime.types['sh'] = 'application/x-sh'; // Shell Script
835
+ mime.types['go'] = 'text/x-go'; // Go
836
+ mime.types['swift'] = 'text/x-swift'; // Swift
837
+ mime.types['kt'] = 'text/x-kotlin'; // Kotlin
838
+ mime.types['rs'] = 'text/x-rustsrc'; // Rust
839
+ mime.types['scala'] = 'text/x-scala'; // Scala
840
+ mime.types['r'] = 'text/x-r-source'; // R
841
+ mime.types['R'] = 'text/x-r-source'; // R (alternatif untuk huruf besar)
842
+ mime.types['lua'] = 'text/x-lua'; // Lua
843
+ mime.types['md'] = 'text/markdown'; // Markdown
844
+ mime.types['json'] = 'application/json'; // JSON
845
+ mime.types['js'] = 'application/javascript'; // JavaScript
846
+ mime.types['ts'] = 'application/x-typescript'; // TypeScript
847
+ mime.types['xml'] = 'application/xml'; // XML
848
+ mime.types['yaml'] = 'application/x-yaml'; // YAML
849
+ mime.types['yml'] = 'application/x-yaml'; // YAML (alternatif)
850
+ mime.types['html'] = 'text/html'; // HTML
851
+ mime.types['htm'] = 'text/html'; // HTML (alternatif)
852
+ mime.types['css'] = 'text/css'; // CSS
853
+ mime.types['scss'] = 'text/x-scss'; // SCSS (Sass)
854
+ mime.types['sass'] = 'text/x-sass'; // Sass
855
+ mime.types['less'] = 'text/x-less'; // Less
856
+ mime.types['coffee'] = 'text/coffeescript'; // CoffeeScript
857
+ mime.types['dart'] = 'application/dart'; // Dart
858
+ mime.types['sql'] = 'application/sql'; // SQL
859
+ mime.types['vb'] = 'text/x-vbscript'; // VBScript
860
+ mime.types['vbs'] = 'text/x-vbscript'; // VBScript (alternatif)
861
+ mime.types['bat'] = 'application/x-msdos-program'; // Batch script
862
+ mime.types['cmd'] = 'application/cmd'; // Command script
863
+ mime.types['ps1'] = 'application/x-powershell'; // PowerShell script
864
+ mime.types['ini'] = 'text/plain'; // INI file
865
+ mime.types['toml'] = 'application/toml'; // TOML
866
+ mime.types['cfg'] = 'text/plain'; // Configuration file
867
+ mime.types['conf'] = 'text/plain'; // Configuration file
868
+ mime.types['properties'] = 'text/plain'; // Properties file
869
+ mime.types['log'] = 'text/plain'; // Log file
870
+ mime.types['yml'] = 'application/x-yaml'; // YAML file
871
+ mime.types['rst'] = 'text/x-rst'; // reStructuredText
872
+ mime.types['latex'] = 'application/x-latex'; // LaTeX
873
+ mime.types['tex'] = 'application/x-tex'; // TeX
874
+ mime.types['bib'] = 'text/x-bibtex'; // BibTeX
875
+ mime.types['mat'] = 'application/x-matlab-data'; // MATLAB
876
+ mime.types['m'] = 'text/x-matlab'; // MATLAB or Objective-C
877
+ mime.types['octave'] = 'text/x-octave'; // GNU Octave
878
+ mime.types['rmd'] = 'text/x-r-markdown'; // R Markdown
879
+ mime.types['jl'] = 'text/x-julia'; // Julia
880
+ mime.types['clj'] = 'text/x-clojure'; // Clojure
881
+ mime.types['cljs'] = 'text/x-clojurescript'; // ClojureScript
882
+ mime.types['cljc'] = 'text/x-clojure'; // Clojure (Common)
883
+ mime.types['erl'] = 'text/x-erlang'; // Erlang
884
+ mime.types['hs'] = 'text/x-haskell'; // Haskell
885
+ mime.types['lhs'] = 'text/x-literate-haskell'; // Literate Haskell
886
+ mime.types['ml'] = 'text/x-ocaml'; // OCaml
887
+ mime.types['mli'] = 'text/x-ocaml'; // OCaml Interface
888
+ mime.types['fs'] = 'text/x-fsharp'; // F#
889
+ mime.types['fsi'] = 'text/x-fsharp'; // F# Interactive
890
+ mime.types['fsx'] = 'text/x-fsharp'; // F# Script
891
+ mime.types['fsscript'] = 'text/x-fsharp'; // F# Script (alternative)
892
+ mime.types['elm'] = 'text/x-elm'; // Elm
893
+ mime.types['elm'] = 'application/elm'; // Elm (alternative)
894
+ mime.types['ex'] = 'text/x-elixir'; // Elixir
895
+ mime.types['exs'] = 'text/x-elixir'; // Elixir Script
896
+ mime.types['eex'] = 'text/x-eex'; // Elixir Embedded Templates
897
+ mime.types['html.eex'] = 'text/x-html-elixir'; // Elixir HTML Embedded Templates
898
+ mime.types['hx'] = 'text/x-haxe'; // Haxe
899
+ mime.types['hxml'] = 'application/hxml'; // Haxe XML
900
+ mime.types['sml'] = 'text/x-sml'; // Standard ML
901
+ mime.types['thy'] = 'text/x-isabelle-theory'; // Isabelle Theory
902
+ mime.types['lean'] = 'text/x-lean'; // Lean
903
+ mime.types['v'] = 'text/x-verilog'; // Verilog
904
+ mime.types['sv'] = 'text/x-systemverilog'; // SystemVerilog
905
+ mime.types['vhd'] = 'text/x-vhdl'; // VHDL
906
+ mime.types['vhdl'] = 'text/x-vhdl'; // VHDL (alternative)
907
+ mime.types['scm'] = 'text/x-scheme'; // Scheme
908
+ mime.types['ss'] = 'text/x-scheme'; // Scheme (alternative)
909
+ mime.types['rkt'] = 'text/x-racket'; // Racket
910
+ mime.types['lisp'] = 'text/x-common-lisp'; // Common Lisp
911
+ mime.types['asd'] = 'text/x-common-lisp'; // Common Lisp ASDF
912
+ mime.types['cl'] = 'text/x-common-lisp'; // Common Lisp (alternative)
913
+ mime.types['el'] = 'text/x-emacs-lisp'; // Emacs Lisp
914
+ mime.types['sc'] = 'text/x-supercollider'; // SuperCollider
915
+ mime.types['f'] = 'text/x-fortran'; // Fortran
916
+ mime.types['f90'] = 'text/x-fortran'; // Fortran (alternative)
917
+ mime.types['f95'] = 'text/x-fortran'; // Fortran (alternative)
918
+ mime.types['v'] = 'text/x-vim'; // Vim Script
919
+ mime.types['pro'] = 'text/x-prolog'; // Prolog
920
+ mime.types['pl'] = 'text/x-prolog'; // Prolog (alternative to Perl)
921
+ mime.types['p'] = 'text/x-pascal'; // Pascal
922
+ mime.types['pas'] = 'text/x-pascal'; // Pascal (alternative)
923
+ mime.types['d'] = 'text/x-d'; // D
924
+ mime.types['ada'] = 'text/x-ada'; // Ada
925
+ mime.types['adb'] = 'text/x-ada'; // Ada Body
926
+ mime.types['ads'] = 'text/x-ada'; // Ada Specification
927
+ mime.types['nim'] = 'text/x-nim'; // Nim
928
+ mime.types['nimble'] = 'text/x-nim'; // Nimble
929
+ mime.types['cr'] = 'text/x-crystal'; // Crystal
930
+ mime.types['cl'] = 'text/x-clarion'; // Clarion
931
+ mime.types['prg'] = 'text/x-clarion'; // Clarion Program
932
+ mime.types['l'] = 'text/x-lex'; // Lex/Flex
933
+ mime.types['yy'] = 'text/x-bison'; // Bison/Yacc
934
+ mime.types['bison'] = 'text/x-bison'; // Bison/Yacc (alternative)
935
+ mime.types['mly'] = 'text/x-menhir'; // Menhir
936
  let {fileTypeFromBuffer} = await (await import('file-type'))
937
  return res.json({
938
  message:"Success",
 
946
  })
947
  } catch (e) {
948
  console.log(e);
949
+ return res.json({ message: "Internal Server Error",
950
  code: 500
951
  });
952
  }