filecat 5.32.0 → 5.32.2
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/build/dist/{377.f1e5a0d0f7800c8306ee.js → 377.4047ae540e74884d3ff5.js} +2 -2
- package/build/dist/543.ac5d314a52e99934103c.js +2 -0
- package/build/dist/{943.7c72fe51510266a06ea6.js → 943.d055d58eee66f1ab0414.js} +2 -2
- package/build/dist/index.html +1 -1
- package/build/dist/{main.b593eb159b18a7b4eefa.js → main.494c8bcf15274aeca600.js} +2 -2
- package/build/server/common/DataUtil.js +7 -0
- package/build/server/common/DataUtil.js.map +1 -0
- package/build/server/common/FileMenuType.js +48 -0
- package/build/server/common/FileMenuType.js.map +1 -0
- package/build/server/common/ListUtil.js +224 -0
- package/build/server/common/ListUtil.js.map +1 -0
- package/build/server/common/Result.pojo.js +15 -0
- package/build/server/common/Result.pojo.js.map +1 -0
- package/build/server/common/RouterConfig.js +20 -0
- package/build/server/common/RouterConfig.js.map +1 -0
- package/build/server/common/StringUtil.js +223 -0
- package/build/server/common/StringUtil.js.map +1 -0
- package/build/server/common/ValueUtil.js +70 -0
- package/build/server/common/ValueUtil.js.map +1 -0
- package/build/server/common/common.util.js +32 -0
- package/build/server/common/common.util.js.map +1 -0
- package/build/server/common/event.js +48 -0
- package/build/server/common/event.js.map +1 -0
- package/build/server/common/file.pojo.js +65 -0
- package/build/server/common/file.pojo.js.map +1 -0
- package/build/server/common/frame/WsData.js +127 -0
- package/build/server/common/frame/WsData.js.map +1 -0
- package/build/server/common/frame/constant.js +6 -0
- package/build/server/common/frame/constant.js.map +1 -0
- package/build/server/common/frame/data.encode.js +115 -0
- package/build/server/common/frame/data.encode.js.map +1 -0
- package/build/server/common/frame/router.js +25 -0
- package/build/server/common/frame/router.js.map +1 -0
- package/build/server/common/frame/ws.client.js +173 -0
- package/build/server/common/frame/ws.client.js.map +1 -0
- package/build/server/common/frame/ws.server.js +145 -0
- package/build/server/common/frame/ws.server.js.map +1 -0
- package/build/server/common/fun.util.js +65 -0
- package/build/server/common/fun.util.js.map +1 -0
- package/build/server/common/node/Env.js +198 -0
- package/build/server/common/node/Env.js.map +1 -0
- package/build/server/common/node/childProcessUtil.js +209 -0
- package/build/server/common/node/childProcessUtil.js.map +1 -0
- package/build/server/common/node/findPort.js +38 -0
- package/build/server/common/node/findPort.js.map +1 -0
- package/build/server/common/node/http.js +38 -0
- package/build/server/common/node/http.js.map +1 -0
- package/build/server/common/node/install.js +132 -0
- package/build/server/common/node/install.js.map +1 -0
- package/build/server/common/node/value.util.js +8 -0
- package/build/server/common/node/value.util.js.map +1 -0
- package/build/server/common/path_util.js +86 -0
- package/build/server/common/path_util.js.map +1 -0
- package/build/server/common/req/common.pojo.js +42 -0
- package/build/server/common/req/common.pojo.js.map +1 -0
- package/build/server/common/req/customerRouter.pojo.js +9 -0
- package/build/server/common/req/customerRouter.pojo.js.map +1 -0
- package/build/server/common/req/data.pojo.js +3 -0
- package/build/server/common/req/data.pojo.js.map +1 -0
- package/build/server/common/req/ddns.pojo.js +39 -0
- package/build/server/common/req/ddns.pojo.js.map +1 -0
- package/build/server/common/req/file.req.js +49 -0
- package/build/server/common/req/file.req.js.map +1 -0
- package/build/server/common/req/http_controller_router.js +13 -0
- package/build/server/common/req/http_controller_router.js.map +1 -0
- package/build/server/common/req/net.pojo.js +71 -0
- package/build/server/common/req/net.pojo.js.map +1 -0
- package/build/server/common/req/setting.req.js +140 -0
- package/build/server/common/req/setting.req.js.map +1 -0
- package/build/server/common/req/ssh.pojo.js +13 -0
- package/build/server/common/req/ssh.pojo.js.map +1 -0
- package/build/server/common/req/sys.pojo.js +29 -0
- package/build/server/common/req/sys.pojo.js.map +1 -0
- package/build/server/common/req/user.req.js +117 -0
- package/build/server/common/req/user.req.js.map +1 -0
- package/build/server/common/word_detection_js.js +142 -0
- package/build/server/common/word_detection_js.js.map +1 -0
- package/build/server/main/domain/ai_agent/ai_agent.constant.js +142 -0
- package/build/server/main/domain/ai_agent/ai_agent.constant.js.map +1 -0
- package/build/server/main/domain/ai_agent/ai_agent.controller.js +136 -0
- package/build/server/main/domain/ai_agent/ai_agent.controller.js.map +1 -0
- package/build/server/main/domain/ai_agent/ai_agent.service.js +715 -0
- package/build/server/main/domain/ai_agent/ai_agent.service.js.map +1 -0
- package/build/server/main/domain/ai_agent/ai_agent.tools.js +79 -0
- package/build/server/main/domain/ai_agent/ai_agent.tools.js.map +1 -0
- package/build/server/main/domain/ai_agent/ai_agent.worker.js +169 -0
- package/build/server/main/domain/ai_agent/ai_agent.worker.js.map +1 -0
- package/build/server/main/domain/bin/bin.file.util.js +109 -0
- package/build/server/main/domain/bin/bin.file.util.js.map +1 -0
- package/build/server/main/domain/bin/bin.js +147 -0
- package/build/server/main/domain/bin/bin.js.map +1 -0
- package/build/server/main/domain/bin/get_bin_dependency.js +36 -0
- package/build/server/main/domain/bin/get_bin_dependency.js.map +1 -0
- package/build/server/main/domain/crypto/crypto.controller.js +50 -0
- package/build/server/main/domain/crypto/crypto.controller.js.map +1 -0
- package/build/server/main/domain/crypto/crypto.service.js +112 -0
- package/build/server/main/domain/crypto/crypto.service.js.map +1 -0
- package/build/server/main/domain/data/DataUtil.js +127 -0
- package/build/server/main/domain/data/DataUtil.js.map +1 -0
- package/build/server/main/domain/data/basedata/base_data_util.js +214 -0
- package/build/server/main/domain/data/basedata/base_data_util.js.map +1 -0
- package/build/server/main/domain/data/data_type.js +92 -0
- package/build/server/main/domain/data/data_type.js.map +1 -0
- package/build/server/main/domain/ddns/ddns.ali.server.js +77 -0
- package/build/server/main/domain/ddns/ddns.ali.server.js.map +1 -0
- package/build/server/main/domain/ddns/ddns.controller.js +88 -0
- package/build/server/main/domain/ddns/ddns.controller.js.map +1 -0
- package/build/server/main/domain/ddns/ddns.dnspod.service.js +102 -0
- package/build/server/main/domain/ddns/ddns.dnspod.service.js.map +1 -0
- package/build/server/main/domain/ddns/ddns.pre.js +104 -0
- package/build/server/main/domain/ddns/ddns.pre.js.map +1 -0
- package/build/server/main/domain/ddns/ddns.service.js +161 -0
- package/build/server/main/domain/ddns/ddns.service.js.map +1 -0
- package/build/server/main/domain/ddns/ddns.tengxun.service.js +46 -0
- package/build/server/main/domain/ddns/ddns.tengxun.service.js.map +1 -0
- package/build/server/main/domain/ddns/tx/abstract_client.js +247 -0
- package/build/server/main/domain/ddns/tx/abstract_client.js.map +1 -0
- package/build/server/main/domain/ddns/tx/dnspod_client.js +38 -0
- package/build/server/main/domain/ddns/tx/dnspod_client.js.map +1 -0
- package/build/server/main/domain/ddns/tx/dnspod_models.js +3 -0
- package/build/server/main/domain/ddns/tx/dnspod_models.js.map +1 -0
- package/build/server/main/domain/ddns/tx/exception/tencent_cloud_sdk_exception.js +38 -0
- package/build/server/main/domain/ddns/tx/exception/tencent_cloud_sdk_exception.js.map +1 -0
- package/build/server/main/domain/ddns/tx/http/fetch.js +3 -0
- package/build/server/main/domain/ddns/tx/http/fetch.js.map +1 -0
- package/build/server/main/domain/ddns/tx/http/http_connection.js +181 -0
- package/build/server/main/domain/ddns/tx/http/http_connection.js.map +1 -0
- package/build/server/main/domain/ddns/tx/interface.js +5 -0
- package/build/server/main/domain/ddns/tx/interface.js.map +1 -0
- package/build/server/main/domain/ddns/tx/sdk_version.js +5 -0
- package/build/server/main/domain/ddns/tx/sdk_version.js.map +1 -0
- package/build/server/main/domain/ddns/tx/sign.js +142 -0
- package/build/server/main/domain/ddns/tx/sign.js.map +1 -0
- package/build/server/main/domain/ddns/tx/sse_response_model.js +89 -0
- package/build/server/main/domain/ddns/tx/sse_response_model.js.map +1 -0
- package/build/server/main/domain/file/FileUtil.js +230 -0
- package/build/server/main/domain/file/FileUtil.js.map +1 -0
- package/build/server/main/domain/file/file.compress.js +246 -0
- package/build/server/main/domain/file/file.compress.js.map +1 -0
- package/build/server/main/domain/file/file.controller.js +450 -0
- package/build/server/main/domain/file/file.controller.js.map +1 -0
- package/build/server/main/domain/file/file.service.js +1276 -0
- package/build/server/main/domain/file/file.service.js.map +1 -0
- package/build/server/main/domain/file/search/file.search.js +78 -0
- package/build/server/main/domain/file/search/file.search.js.map +1 -0
- package/build/server/main/domain/file/search/file.search.worker.js +107 -0
- package/build/server/main/domain/file/search/file.search.worker.js.map +1 -0
- package/build/server/main/domain/file/search/file.type.js +3 -0
- package/build/server/main/domain/file/search/file.type.js.map +1 -0
- package/build/server/main/domain/file/workflow/workflow.process.js +100 -0
- package/build/server/main/domain/file/workflow/workflow.process.js.map +1 -0
- package/build/server/main/domain/file/workflow/workflow.service.js +659 -0
- package/build/server/main/domain/file/workflow/workflow.service.js.map +1 -0
- package/build/server/main/domain/file/workflow/workflow.util.js +111 -0
- package/build/server/main/domain/file/workflow/workflow.util.js.map +1 -0
- package/build/server/main/domain/navindex/navindex.controller.js +73 -0
- package/build/server/main/domain/navindex/navindex.controller.js.map +1 -0
- package/build/server/main/domain/net/net.controller.js +318 -0
- package/build/server/main/domain/net/net.controller.js.map +1 -0
- package/build/server/main/domain/net/net.datautil.js +8 -0
- package/build/server/main/domain/net/net.datautil.js.map +1 -0
- package/build/server/main/domain/net/net.service.js +627 -0
- package/build/server/main/domain/net/net.service.js.map +1 -0
- package/build/server/main/domain/net/tcp.forward.client.service.js +223 -0
- package/build/server/main/domain/net/tcp.forward.client.service.js.map +1 -0
- package/build/server/main/domain/net/tcp.forward.controller.js +482 -0
- package/build/server/main/domain/net/tcp.forward.controller.js.map +1 -0
- package/build/server/main/domain/net/tcp.forward.server.service.js +407 -0
- package/build/server/main/domain/net/tcp.forward.server.service.js.map +1 -0
- package/build/server/main/domain/net/type.js +3 -0
- package/build/server/main/domain/net/type.js.map +1 -0
- package/build/server/main/domain/net/util/NetClientUtil.js +76 -0
- package/build/server/main/domain/net/util/NetClientUtil.js.map +1 -0
- package/build/server/main/domain/net/util/NetServerUtil.js +128 -0
- package/build/server/main/domain/net/util/NetServerUtil.js.map +1 -0
- package/build/server/main/domain/net/util/NetUtil.js +187 -0
- package/build/server/main/domain/net/util/NetUtil.js.map +1 -0
- package/build/server/main/domain/net/util/tcp.client.js +211 -0
- package/build/server/main/domain/net/util/tcp.client.js.map +1 -0
- package/build/server/main/domain/net/util/tcp_stream_util.js +69 -0
- package/build/server/main/domain/net/util/tcp_stream_util.js.map +1 -0
- package/build/server/main/domain/net/util/type.js +3 -0
- package/build/server/main/domain/net/util/type.js.map +1 -0
- package/build/server/main/domain/net/virtual/tcp_proxy.js +125 -0
- package/build/server/main/domain/net/virtual/tcp_proxy.js.map +1 -0
- package/build/server/main/domain/net/virtual/virtual.client.service.js +402 -0
- package/build/server/main/domain/net/virtual/virtual.client.service.js.map +1 -0
- package/build/server/main/domain/net/virtual/virtual.controller.js +211 -0
- package/build/server/main/domain/net/virtual/virtual.controller.js.map +1 -0
- package/build/server/main/domain/net/virtual/virtual.server.service.js +72 -0
- package/build/server/main/domain/net/virtual/virtual.server.service.js.map +1 -0
- package/build/server/main/domain/pre/lifeRecordService.js +79 -0
- package/build/server/main/domain/pre/lifeRecordService.js.map +1 -0
- package/build/server/main/domain/rdp/lib/asn1/ber.js +66 -0
- package/build/server/main/domain/rdp/lib/asn1/ber.js.map +1 -0
- package/build/server/main/domain/rdp/lib/asn1/index.js +9 -0
- package/build/server/main/domain/rdp/lib/asn1/index.js.map +1 -0
- package/build/server/main/domain/rdp/lib/asn1/spec.js +56 -0
- package/build/server/main/domain/rdp/lib/asn1/spec.js.map +1 -0
- package/build/server/main/domain/rdp/lib/asn1/univ.js +315 -0
- package/build/server/main/domain/rdp/lib/asn1/univ.js.map +1 -0
- package/build/server/main/domain/rdp/lib/core/error.js +25 -0
- package/build/server/main/domain/rdp/lib/core/error.js.map +1 -0
- package/build/server/main/domain/rdp/lib/core/index.js +13 -0
- package/build/server/main/domain/rdp/lib/core/index.js.map +1 -0
- package/build/server/main/domain/rdp/lib/core/layer.js +135 -0
- package/build/server/main/domain/rdp/lib/core/layer.js.map +1 -0
- package/build/server/main/domain/rdp/lib/core/log.js +25 -0
- package/build/server/main/domain/rdp/lib/core/log.js.map +1 -0
- package/build/server/main/domain/rdp/lib/core/rle.js +22699 -0
- package/build/server/main/domain/rdp/lib/core/rle.js.map +1 -0
- package/build/server/main/domain/rdp/lib/core/type.js +245 -0
- package/build/server/main/domain/rdp/lib/core/type.js.map +1 -0
- package/build/server/main/domain/rdp/lib/index.js +6 -0
- package/build/server/main/domain/rdp/lib/index.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/cert.js +115 -0
- package/build/server/main/domain/rdp/lib/protocol/cert.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/index.js +11 -0
- package/build/server/main/domain/rdp/lib/protocol/index.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/nla.js +549 -0
- package/build/server/main/domain/rdp/lib/protocol/nla.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/caps.js +486 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/caps.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/cliprdr.js +167 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/cliprdr.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/data.js +876 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/data.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/global.js +260 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/global.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/index.js +13 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/index.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/lic.js +199 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/lic.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/sec.js +333 -0
- package/build/server/main/domain/rdp/lib/protocol/pdu/sec.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/rdp.js +255 -0
- package/build/server/main/domain/rdp/lib/protocol/rdp.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/gcc.js +354 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/gcc.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/index.js +7 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/index.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/mcs.js +318 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/mcs.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/per.js +188 -0
- package/build/server/main/domain/rdp/lib/protocol/t125/per.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/tpkt.js +94 -0
- package/build/server/main/domain/rdp/lib/protocol/tpkt.js.map +1 -0
- package/build/server/main/domain/rdp/lib/protocol/x224.js +207 -0
- package/build/server/main/domain/rdp/lib/protocol/x224.js.map +1 -0
- package/build/server/main/domain/rdp/lib/security/index.js +7 -0
- package/build/server/main/domain/rdp/lib/security/index.js.map +1 -0
- package/build/server/main/domain/rdp/lib/security/jsbn.js +1372 -0
- package/build/server/main/domain/rdp/lib/security/jsbn.js.map +1 -0
- package/build/server/main/domain/rdp/lib/security/md4.js +401 -0
- package/build/server/main/domain/rdp/lib/security/md4.js.map +1 -0
- package/build/server/main/domain/rdp/lib/security/rc4.js +45 -0
- package/build/server/main/domain/rdp/lib/security/rc4.js.map +1 -0
- package/build/server/main/domain/rdp/lib/security/rsa.js +15 -0
- package/build/server/main/domain/rdp/lib/security/rsa.js.map +1 -0
- package/build/server/main/domain/rdp/lib/security/x509.js +106 -0
- package/build/server/main/domain/rdp/lib/security/x509.js.map +1 -0
- package/build/server/main/domain/rdp/rdp.controller.js +116 -0
- package/build/server/main/domain/rdp/rdp.controller.js.map +1 -0
- package/build/server/main/domain/rdp/rdp.service.js +117 -0
- package/build/server/main/domain/rdp/rdp.service.js.map +1 -0
- package/build/server/main/domain/setting/setting.controller.js +621 -0
- package/build/server/main/domain/setting/setting.controller.js.map +1 -0
- package/build/server/main/domain/setting/setting.prefile.js +69 -0
- package/build/server/main/domain/setting/setting.prefile.js.map +1 -0
- package/build/server/main/domain/setting/setting.service.js +763 -0
- package/build/server/main/domain/setting/setting.service.js.map +1 -0
- package/build/server/main/domain/shell/shell.controller.js +92 -0
- package/build/server/main/domain/shell/shell.controller.js.map +1 -0
- package/build/server/main/domain/shell/shell.service.js +448 -0
- package/build/server/main/domain/shell/shell.service.js.map +1 -0
- package/build/server/main/domain/shell/util.js +101 -0
- package/build/server/main/domain/shell/util.js.map +1 -0
- package/build/server/main/domain/ssh/ssh.controller.js +203 -0
- package/build/server/main/domain/ssh/ssh.controller.js.map +1 -0
- package/build/server/main/domain/ssh/ssh.service.js +238 -0
- package/build/server/main/domain/ssh/ssh.service.js.map +1 -0
- package/build/server/main/domain/ssh/ssh.ssh2.js +217 -0
- package/build/server/main/domain/ssh/ssh.ssh2.js.map +1 -0
- package/build/server/main/domain/sys/sys.controller.js +374 -0
- package/build/server/main/domain/sys/sys.controller.js.map +1 -0
- package/build/server/main/domain/sys/sys.docker.service.js +339 -0
- package/build/server/main/domain/sys/sys.docker.service.js.map +1 -0
- package/build/server/main/domain/sys/sys.process.service.js +218 -0
- package/build/server/main/domain/sys/sys.process.service.js.map +1 -0
- package/build/server/main/domain/sys/sys.service.js +85 -0
- package/build/server/main/domain/sys/sys.service.js.map +1 -0
- package/build/server/main/domain/sys/sys.sys.service.js +206 -0
- package/build/server/main/domain/sys/sys.sys.service.js.map +1 -0
- package/build/server/main/domain/sys/sys.systemd.service.js +276 -0
- package/build/server/main/domain/sys/sys.systemd.service.js.map +1 -0
- package/build/server/main/domain/sys/sys.utl.js +42 -0
- package/build/server/main/domain/sys/sys.utl.js.map +1 -0
- package/build/server/main/domain/user/user.controller.js +277 -0
- package/build/server/main/domain/user/user.controller.js.map +1 -0
- package/build/server/main/domain/user/user.hash.js +8 -0
- package/build/server/main/domain/user/user.hash.js.map +1 -0
- package/build/server/main/domain/user/user.service.js +584 -0
- package/build/server/main/domain/user/user.service.js.map +1 -0
- package/build/server/main/domain/video/video.controller.js +71 -0
- package/build/server/main/domain/video/video.controller.js.map +1 -0
- package/build/server/main/domain/video/video.service.js +45 -0
- package/build/server/main/domain/video/video.service.js.map +1 -0
- package/build/server/main/main.js +171 -0
- package/build/server/main/main.js.map +1 -0
- package/build/server/main/other/Result.js +25 -0
- package/build/server/main/other/Result.js.map +1 -0
- package/build/server/main/other/cache.js +50 -0
- package/build/server/main/other/cache.js.map +1 -0
- package/build/server/main/other/config.js +6 -0
- package/build/server/main/other/config.js.map +1 -0
- package/build/server/main/other/middleware/AuthMiddleware.js +101 -0
- package/build/server/main/other/middleware/AuthMiddleware.js.map +1 -0
- package/build/server/main/other/middleware/GlobalErrorHandler.js +23 -0
- package/build/server/main/other/middleware/GlobalErrorHandler.js.map +1 -0
- package/build/server/main/other/middleware/decorator.js +15 -0
- package/build/server/main/other/middleware/decorator.js.map +1 -0
- package/build/server/main/other/middleware/redirect.js +20 -0
- package/build/server/main/other/middleware/redirect.js.map +1 -0
- package/build/server/main/server.js +22 -0
- package/build/server/main/server.js.map +1 -0
- package/build/server/main/threads/filecat/threads.filecat.js +16 -0
- package/build/server/main/threads/filecat/threads.filecat.js.map +1 -0
- package/build/server/main/threads/filecat/threads.work.filecat.js +7 -0
- package/build/server/main/threads/filecat/threads.work.filecat.js.map +1 -0
- package/build/server/main/threads/threads.main.js +224 -0
- package/build/server/main/threads/threads.main.js.map +1 -0
- package/build/server/main/threads/threads.type.js +19 -0
- package/build/server/main/threads/threads.type.js.map +1 -0
- package/build/server/main/threads/threads.work.js +52 -0
- package/build/server/main/threads/threads.work.js.map +1 -0
- package/build/server/main/watch.js +187 -0
- package/build/server/main/watch.js.map +1 -0
- package/build/server/tsconfig.tsbuildinfo +1 -0
- package/build/server/web/project/util/noty.js +45 -0
- package/build/server/web/project/util/noty.js.map +1 -0
- package/build/threads.work.filecat.js +1 -1
- package/package.json +5 -4
- package/shell/build.js +8 -0
- package/build/dist/543.9305b93ceeffabfa9862.js +0 -2
- package/build/jieba_rs_wasm_bg.wasm +0 -0
- package/build/main.js +0 -2
- package/build/main.js.LICENSE.txt +0 -445
- package/build/unrar.wasm +0 -0
- /package/build/dist/{377.f1e5a0d0f7800c8306ee.js.LICENSE.txt → 377.4047ae540e74884d3ff5.js.LICENSE.txt} +0 -0
- /package/build/dist/{543.9305b93ceeffabfa9862.js.LICENSE.txt → 543.ac5d314a52e99934103c.js.LICENSE.txt} +0 -0
- /package/build/dist/{943.7c72fe51510266a06ea6.js.LICENSE.txt → 943.d055d58eee66f1ab0414.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.b593eb159b18a7b4eefa.js.LICENSE.txt → main.494c8bcf15274aeca600.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,1276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FileServiceImpl = exports.FileService = void 0;
|
|
7
|
+
const file_pojo_1 = require("../../../common/file.pojo");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const Result_1 = require("../../other/Result");
|
|
12
|
+
const rimraf_1 = require("rimraf");
|
|
13
|
+
const ValueUtil_1 = require("../../../common/ValueUtil");
|
|
14
|
+
const setting_service_1 = require("../setting/setting.service");
|
|
15
|
+
const WsData_1 = require("../../../common/frame/WsData");
|
|
16
|
+
const Result_pojo_1 = require("../../../common/Result.pojo");
|
|
17
|
+
const file_compress_1 = require("./file.compress");
|
|
18
|
+
const get_bin_dependency_1 = require("../bin/get_bin_dependency");
|
|
19
|
+
const FileMenuType_1 = require("../../../common/FileMenuType");
|
|
20
|
+
const StringUtil_1 = require("../../../common/StringUtil");
|
|
21
|
+
const systeminformation_1 = __importDefault(require("systeminformation"));
|
|
22
|
+
const multer_1 = __importDefault(require("multer"));
|
|
23
|
+
const user_service_1 = require("../user/user.service");
|
|
24
|
+
const user_req_1 = require("../../../common/req/user.req");
|
|
25
|
+
const FileUtil_1 = require("./FileUtil");
|
|
26
|
+
const { node_process_watcher } = (0, get_bin_dependency_1.get_bin_dependency)("node-process-watcher", false);
|
|
27
|
+
const ListUtil_1 = require("../../../common/ListUtil");
|
|
28
|
+
const path_util_1 = require("../../../common/path_util");
|
|
29
|
+
const DataUtil_1 = require("../data/DataUtil");
|
|
30
|
+
const data_type_1 = require("../data/data_type");
|
|
31
|
+
const shell_service_1 = require("../shell/shell.service");
|
|
32
|
+
const archiver = require('archiver');
|
|
33
|
+
const mime = require('mime-types');
|
|
34
|
+
const chokidar = require('chokidar');
|
|
35
|
+
const iconv = require('iconv-lite');
|
|
36
|
+
class FileService {
|
|
37
|
+
constructor() {
|
|
38
|
+
this.fileUploadOptions = {
|
|
39
|
+
storage: multer_1.default.diskStorage({
|
|
40
|
+
destination: (req, file, cb) => {
|
|
41
|
+
cb(null, req.fileDir);
|
|
42
|
+
},
|
|
43
|
+
filename: (req, file, cb) => {
|
|
44
|
+
cb(null, req.fileName);
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
this.upload = (0, multer_1.default)({
|
|
49
|
+
storage: this.fileUploadOptions.storage,
|
|
50
|
+
}).single('file');
|
|
51
|
+
this.upload_num_set = {};
|
|
52
|
+
this.file_upload_count_map = new Map();
|
|
53
|
+
this.file_change_watcher_map = new Map();
|
|
54
|
+
}
|
|
55
|
+
utf8ToEncoding(utf8Str, targetEncoding, outputFormat = 'buffer') {
|
|
56
|
+
const buffer = iconv.encode(utf8Str, targetEncoding);
|
|
57
|
+
switch (outputFormat.toLowerCase()) {
|
|
58
|
+
case 'buffer':
|
|
59
|
+
return buffer;
|
|
60
|
+
case 'hex':
|
|
61
|
+
return buffer.toString('hex');
|
|
62
|
+
case 'base64':
|
|
63
|
+
return buffer.toString('base64');
|
|
64
|
+
case 'string':
|
|
65
|
+
if (['latin1', 'iso-8859-1'].includes(targetEncoding.toLowerCase())) {
|
|
66
|
+
return buffer.toString('binary');
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
throw new Error(`outputFormat 'string' 仅支持 'latin1' 或 'iso-8859-1' 编码`);
|
|
70
|
+
}
|
|
71
|
+
default:
|
|
72
|
+
throw new Error(`不支持的 outputFormat: ${outputFormat},可选 'buffer' | 'hex' | 'base64' | 'string'`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async get_file_base_info(token, param_path) {
|
|
76
|
+
let sysPath = decodeURIComponent(param_path);
|
|
77
|
+
const root_path = setting_service_1.settingService.getFileRootPath(token);
|
|
78
|
+
if ((0, path_util_1.isAbsolutePath)(sysPath)) {
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
sysPath = path_1.default.join(root_path, sysPath);
|
|
82
|
+
}
|
|
83
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
84
|
+
const stat = await FileUtil_1.FileUtil.statSync(sysPath);
|
|
85
|
+
return {
|
|
86
|
+
name: path_1.default.basename(sysPath),
|
|
87
|
+
path: sysPath,
|
|
88
|
+
size: stat.size,
|
|
89
|
+
isFile: stat.isFile(),
|
|
90
|
+
isSymbolicLink: stat.isSymbolicLink(),
|
|
91
|
+
createdAt: stat.birthtime?.getTime(),
|
|
92
|
+
modifiedAt: stat.mtime?.getTime(),
|
|
93
|
+
accessedAt: stat.atime?.getTime(),
|
|
94
|
+
mode: stat.mode,
|
|
95
|
+
uid: stat.uid,
|
|
96
|
+
uname: (0, shell_service_1.getSys)() === user_req_1.SysEnum.win ? node_process_watcher?.get_file_owner(sysPath)?.username : node_process_watcher?.get_username_by_uid(stat.uid)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async getFile(param_path, token) {
|
|
100
|
+
const result = {
|
|
101
|
+
files: [],
|
|
102
|
+
folders: []
|
|
103
|
+
};
|
|
104
|
+
const root_path = setting_service_1.settingService.getFileRootPath(token);
|
|
105
|
+
let sysPath = decodeURIComponent(param_path);
|
|
106
|
+
if ((0, path_util_1.isAbsolutePath)(sysPath)) {
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
sysPath = path_1.default.join(root_path, sysPath);
|
|
110
|
+
}
|
|
111
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
112
|
+
if (!await FileUtil_1.FileUtil.access(sysPath)) {
|
|
113
|
+
return (0, Result_1.Fail)("路径不存在", Result_pojo_1.RCode.Fail);
|
|
114
|
+
}
|
|
115
|
+
const stats = await FileUtil_1.FileUtil.statSync(sysPath);
|
|
116
|
+
if (stats.isFile()) {
|
|
117
|
+
const name = path_1.default.basename(sysPath);
|
|
118
|
+
const buffer = await FileUtil_1.FileUtil.readFileSync(sysPath);
|
|
119
|
+
const pojo = (0, Result_1.Sucess)(buffer.toString(), Result_pojo_1.RCode.PreFile);
|
|
120
|
+
pojo.message = name;
|
|
121
|
+
return pojo;
|
|
122
|
+
}
|
|
123
|
+
const items = await FileUtil_1.FileUtil.readdirSync(sysPath);
|
|
124
|
+
for (const item of items) {
|
|
125
|
+
const filePath = path_1.default.join(sysPath, item);
|
|
126
|
+
let stats = null;
|
|
127
|
+
try {
|
|
128
|
+
stats = await FileUtil_1.FileUtil.statSync(filePath);
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const mtime = stats ? new Date(stats.mtime).getTime() : 0;
|
|
134
|
+
if (stats && stats.isFile()) {
|
|
135
|
+
const type = (0, FileMenuType_1.getFileFormat)(item);
|
|
136
|
+
result.files?.push({
|
|
137
|
+
type: type,
|
|
138
|
+
name: item,
|
|
139
|
+
mtime: mtime,
|
|
140
|
+
size: stats.size,
|
|
141
|
+
isLink: stats?.isSymbolicLink(),
|
|
142
|
+
path: path_1.default.join(param_path, item)
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else if (stats && stats.isDirectory()) {
|
|
146
|
+
result.folders?.push({
|
|
147
|
+
type: file_pojo_1.FileTypeEnum.folder,
|
|
148
|
+
name: item,
|
|
149
|
+
mtime: mtime,
|
|
150
|
+
isLink: stats?.isSymbolicLink(),
|
|
151
|
+
path: param_path
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
result.files?.push({
|
|
156
|
+
type: file_pojo_1.FileTypeEnum.dev,
|
|
157
|
+
name: item,
|
|
158
|
+
mtime: mtime,
|
|
159
|
+
size: stats?.size,
|
|
160
|
+
path: path_1.default.join(param_path, item)
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return (0, Result_1.Sucess)(result);
|
|
165
|
+
}
|
|
166
|
+
async get_list(token, param_path, page_num, page_size, search) {
|
|
167
|
+
const result = {
|
|
168
|
+
files: []
|
|
169
|
+
};
|
|
170
|
+
const root_path = setting_service_1.settingService.getFileRootPath(token);
|
|
171
|
+
const sysPath = path_1.default.join(root_path, param_path ? decodeURIComponent(param_path) : "");
|
|
172
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
173
|
+
let items = await FileUtil_1.FileUtil.readdirSync(sysPath);
|
|
174
|
+
items = (0, ListUtil_1.list_paginate)(items, page_num, page_size).list;
|
|
175
|
+
for (const item of items) {
|
|
176
|
+
const filePath = path_1.default.join(sysPath, item);
|
|
177
|
+
let stats = null;
|
|
178
|
+
try {
|
|
179
|
+
stats = await FileUtil_1.FileUtil.statSync(filePath);
|
|
180
|
+
}
|
|
181
|
+
catch (e) {
|
|
182
|
+
console.log("读取错误", e);
|
|
183
|
+
}
|
|
184
|
+
let type;
|
|
185
|
+
let p;
|
|
186
|
+
let size;
|
|
187
|
+
if (!stats)
|
|
188
|
+
continue;
|
|
189
|
+
if (stats.isFile()) {
|
|
190
|
+
type = (0, FileMenuType_1.getFileFormat)(item);
|
|
191
|
+
p = path_1.default.join(param_path, item);
|
|
192
|
+
size = stats.size;
|
|
193
|
+
}
|
|
194
|
+
else if (stats.isDirectory()) {
|
|
195
|
+
type = file_pojo_1.FileTypeEnum.folder;
|
|
196
|
+
p = param_path;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
type = file_pojo_1.FileTypeEnum.dev;
|
|
200
|
+
p = path_1.default.join(param_path, item);
|
|
201
|
+
size = stats.size;
|
|
202
|
+
}
|
|
203
|
+
const mtime = stats ? new Date(stats.mtime).getTime() : 0;
|
|
204
|
+
const pojo = {
|
|
205
|
+
type,
|
|
206
|
+
name: item,
|
|
207
|
+
mtime: mtime,
|
|
208
|
+
size,
|
|
209
|
+
isLink: stats?.isSymbolicLink(),
|
|
210
|
+
path: p
|
|
211
|
+
};
|
|
212
|
+
result.files.push(pojo);
|
|
213
|
+
}
|
|
214
|
+
return (0, Result_1.Sucess)(result);
|
|
215
|
+
}
|
|
216
|
+
async get_folder_info(fpath, token, wss) {
|
|
217
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), decodeURIComponent(fpath));
|
|
218
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
219
|
+
node_process_watcher?.on_folder_size(sysPath, (file_num, total_size) => {
|
|
220
|
+
wss.send(WsData_1.CmdType.folder_size_info, [file_num, total_size]);
|
|
221
|
+
});
|
|
222
|
+
wss.setClose(() => {
|
|
223
|
+
node_process_watcher?.stop_folder_size(sysPath);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
async stop_folder_info(fpath, token) {
|
|
227
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), decodeURIComponent(fpath));
|
|
228
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
229
|
+
node_process_watcher?.stop_folder_size(sysPath);
|
|
230
|
+
}
|
|
231
|
+
async getFileInfo(type, fpath, token, wss) {
|
|
232
|
+
let info = {};
|
|
233
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), decodeURIComponent(fpath));
|
|
234
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
235
|
+
switch (type) {
|
|
236
|
+
case file_pojo_1.FileTypeEnum.folder:
|
|
237
|
+
if (wss) {
|
|
238
|
+
this.getDiskSizeForPath(sysPath).then(data => {
|
|
239
|
+
const result = new WsData_1.WsData(WsData_1.CmdType.file_info);
|
|
240
|
+
result.context = data;
|
|
241
|
+
wss.sendData(result.encode());
|
|
242
|
+
}).catch(error => {
|
|
243
|
+
console.log(error);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
info = await this.getDiskSizeForPath(sysPath);
|
|
248
|
+
}
|
|
249
|
+
break;
|
|
250
|
+
case file_pojo_1.FileTypeEnum.upload_folder:
|
|
251
|
+
{
|
|
252
|
+
const list = setting_service_1.settingService.get_dir_upload_max_num();
|
|
253
|
+
for (const it of list) {
|
|
254
|
+
if (user_service_1.userService.isSubPath(it.path, sysPath)) {
|
|
255
|
+
info.dir_upload_max_num_value = it;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
default:
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
info.now_absolute_path = sysPath;
|
|
264
|
+
return info;
|
|
265
|
+
}
|
|
266
|
+
async uploadFile(filePath, req, res, token) {
|
|
267
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), filePath ? decodeURIComponent(filePath) : "");
|
|
268
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
269
|
+
user_service_1.userService.check_user_only_path(token, sysPath);
|
|
270
|
+
if ((req.query.dir === "1")) {
|
|
271
|
+
if (!await FileUtil_1.FileUtil.access(sysPath))
|
|
272
|
+
await FileUtil_1.FileUtil.mkdirSync(sysPath, { recursive: true });
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
let upload_max_key;
|
|
276
|
+
let max_num;
|
|
277
|
+
for (const it of setting_service_1.settingService.get_dir_upload_max_num()) {
|
|
278
|
+
if (user_service_1.userService.isSubPath(it.path, sysPath) && it.sys_upload_num !== undefined) {
|
|
279
|
+
upload_max_key = it.path;
|
|
280
|
+
max_num = it.sys_upload_num;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (upload_max_key) {
|
|
284
|
+
let v = this.upload_num_set[upload_max_key];
|
|
285
|
+
if (v === undefined) {
|
|
286
|
+
v = 1;
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
v++;
|
|
290
|
+
}
|
|
291
|
+
if (v > max_num)
|
|
292
|
+
throw " upload file num max ";
|
|
293
|
+
this.upload_num_set[upload_max_key] = v;
|
|
294
|
+
}
|
|
295
|
+
req['fileDir'] = path_1.default.dirname(sysPath);
|
|
296
|
+
req['fileName'] = path_1.default.basename(sysPath);
|
|
297
|
+
req.on('close', () => {
|
|
298
|
+
if (upload_max_key) {
|
|
299
|
+
if (this.upload_num_set[upload_max_key]) {
|
|
300
|
+
this.upload_num_set[upload_max_key]--;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
return new Promise((resolve) => {
|
|
305
|
+
try {
|
|
306
|
+
this.upload(req, res, (err) => {
|
|
307
|
+
if (err) {
|
|
308
|
+
console.log(err);
|
|
309
|
+
}
|
|
310
|
+
if (upload_max_key) {
|
|
311
|
+
if (this.upload_num_set[upload_max_key]) {
|
|
312
|
+
this.upload_num_set[upload_max_key]--;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
resolve(1);
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
catch (e) {
|
|
319
|
+
if (upload_max_key) {
|
|
320
|
+
if (this.upload_num_set[upload_max_key]) {
|
|
321
|
+
this.upload_num_set[upload_max_key]--;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
resolve(1);
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
async file_upload_pre(data) {
|
|
329
|
+
const param = data.context;
|
|
330
|
+
const token = data.wss.token;
|
|
331
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), param.file_path ? decodeURIComponent(param.file_path) : "");
|
|
332
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
333
|
+
user_service_1.userService.check_user_only_path(token, sysPath);
|
|
334
|
+
if (param.is_dir) {
|
|
335
|
+
if (!await FileUtil_1.FileUtil.access(sysPath))
|
|
336
|
+
await FileUtil_1.FileUtil.mkdirSync(sysPath, { recursive: true });
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
let max_num;
|
|
340
|
+
let upload_max_key;
|
|
341
|
+
for (const it of setting_service_1.settingService.get_dir_upload_max_num()) {
|
|
342
|
+
if (user_service_1.userService.isSubPath(it.path, sysPath) && it.sys_upload_num !== undefined) {
|
|
343
|
+
upload_max_key = it.path;
|
|
344
|
+
max_num = it.sys_upload_num;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (upload_max_key) {
|
|
348
|
+
let v = this.upload_num_set[upload_max_key];
|
|
349
|
+
if (v === undefined) {
|
|
350
|
+
v = 1;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
v++;
|
|
354
|
+
}
|
|
355
|
+
if (v > max_num)
|
|
356
|
+
throw " upload file num max ";
|
|
357
|
+
this.upload_num_set[upload_max_key] = v;
|
|
358
|
+
}
|
|
359
|
+
data.wss.setClose(() => {
|
|
360
|
+
if (upload_max_key) {
|
|
361
|
+
if (this.upload_num_set[upload_max_key]) {
|
|
362
|
+
this.upload_num_set[upload_max_key]--;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
let value = this.file_upload_count_map.get(sysPath);
|
|
367
|
+
if (value) {
|
|
368
|
+
value.buffer_list = new Array(param.parallel_done_num).fill(undefined);
|
|
369
|
+
value.parallel_done_num = 0;
|
|
370
|
+
if (param.lastModified !== value.lastModified) {
|
|
371
|
+
if (await FileUtil_1.FileUtil.access(sysPath)) {
|
|
372
|
+
await FileUtil_1.FileUtil.unlinkSync(sysPath);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
else if (await FileUtil_1.FileUtil.access(sysPath)) {
|
|
376
|
+
return { upload_data_size: value.upload_data_size };
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
file_compress_1.fileCompress.lifeStart(sysPath, upload_max_key, async (key) => {
|
|
380
|
+
this.file_upload_count_map.delete(upload_max_key);
|
|
381
|
+
value.writeStream.end();
|
|
382
|
+
value.buffer_list = null;
|
|
383
|
+
this.file_upload_count_map.delete(sysPath);
|
|
384
|
+
});
|
|
385
|
+
if (await FileUtil_1.FileUtil.access(sysPath)) {
|
|
386
|
+
await FileUtil_1.FileUtil.truncateSync(sysPath);
|
|
387
|
+
}
|
|
388
|
+
param.file_full_path = sysPath;
|
|
389
|
+
value = {
|
|
390
|
+
upload_data_size: 0,
|
|
391
|
+
wss: data.wss,
|
|
392
|
+
lastModified: param.lastModified,
|
|
393
|
+
buffer_list: new Array(param.parallel_done_num).fill(undefined),
|
|
394
|
+
sys_file_max_num: max_num,
|
|
395
|
+
sys_file_upload_max_key: upload_max_key,
|
|
396
|
+
parallel_done_num: 0,
|
|
397
|
+
writeStream: fs_1.default.createWriteStream(sysPath)
|
|
398
|
+
};
|
|
399
|
+
this.file_upload_count_map.set(sysPath, value);
|
|
400
|
+
return { upload_data_size: value.upload_data_size };
|
|
401
|
+
}
|
|
402
|
+
async file_upload(data) {
|
|
403
|
+
const param = data.context;
|
|
404
|
+
const token = data.wss.token;
|
|
405
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), param.file_path ? decodeURIComponent(param.file_path) : "");
|
|
406
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
407
|
+
user_service_1.userService.check_user_only_path(token, sysPath);
|
|
408
|
+
file_compress_1.fileCompress.lifeHeart(sysPath);
|
|
409
|
+
const num_value = this.file_upload_count_map.get(sysPath);
|
|
410
|
+
try {
|
|
411
|
+
num_value.buffer_list[param.part_count] = data.bin_context;
|
|
412
|
+
delete data.bin_context;
|
|
413
|
+
num_value.parallel_done_num++;
|
|
414
|
+
if (num_value.parallel_done_num !== param.parallel_done_num) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
num_value.parallel_done_num = 0;
|
|
418
|
+
for (const add_chunk of num_value.buffer_list) {
|
|
419
|
+
num_value.writeStream.write(add_chunk);
|
|
420
|
+
num_value.upload_data_size += add_chunk.length;
|
|
421
|
+
}
|
|
422
|
+
num_value.buffer_list.length = 0;
|
|
423
|
+
num_value.buffer_list = new Array(param.parallel_done_num).fill(undefined);
|
|
424
|
+
if (param.chunk_index === param.total_chunk_index - 1) {
|
|
425
|
+
if (num_value.sys_file_upload_max_key) {
|
|
426
|
+
if (this.upload_num_set[num_value.sys_file_upload_max_key]) {
|
|
427
|
+
this.upload_num_set[num_value.sys_file_upload_max_key]--;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
this.file_upload_count_map.delete(sysPath);
|
|
431
|
+
num_value.writeStream.end();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
catch (e) {
|
|
435
|
+
console.log(e);
|
|
436
|
+
if (num_value.sys_file_upload_max_key) {
|
|
437
|
+
if (this.upload_num_set[num_value.sys_file_upload_max_key]) {
|
|
438
|
+
this.upload_num_set[num_value.sys_file_upload_max_key]--;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
num_value.writeStream.end();
|
|
442
|
+
this.file_upload_count_map.delete(sysPath);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
async deletes(token, filePath) {
|
|
446
|
+
if (!filePath) {
|
|
447
|
+
return (0, Result_1.Sucess)("1");
|
|
448
|
+
}
|
|
449
|
+
let sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), decodeURIComponent(filePath));
|
|
450
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
451
|
+
if (user_service_1.userService.protectionCheck(sysPath, token) || setting_service_1.settingService.protectionCheck(sysPath)) {
|
|
452
|
+
return (0, Result_1.Fail)("1", Result_pojo_1.RCode.PROTECT_FILE);
|
|
453
|
+
}
|
|
454
|
+
if (setting_service_1.settingService.get_recycle_bin_status()) {
|
|
455
|
+
sysPath = (0, StringUtil_1.removeTrailingPath)(sysPath);
|
|
456
|
+
const cyc_map_list = setting_service_1.settingService.get_recycle_dir_map_list();
|
|
457
|
+
for (const it of cyc_map_list) {
|
|
458
|
+
let cyc_p;
|
|
459
|
+
let check_cyc_p = "";
|
|
460
|
+
if (it.length > 1 && !!it[1]) {
|
|
461
|
+
cyc_p = (0, StringUtil_1.removeTrailingPath)(it[1]);
|
|
462
|
+
check_cyc_p = it[0];
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
cyc_p = (0, StringUtil_1.removeTrailingPath)(it[0]);
|
|
466
|
+
}
|
|
467
|
+
if (cyc_p === sysPath) {
|
|
468
|
+
throw "cyc dir not to del";
|
|
469
|
+
}
|
|
470
|
+
if (check_cyc_p !== "" && !user_service_1.userService.isSubPath(check_cyc_p, sysPath)) {
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
if (user_service_1.userService.isSubPath(cyc_p, sysPath)) {
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
const ext_name = path_1.default.extname(sysPath);
|
|
477
|
+
const fileName = path_1.default.basename(filePath, ext_name);
|
|
478
|
+
let p = path_1.default.join(cyc_p, `${fileName}${ext_name}`);
|
|
479
|
+
if (await FileUtil_1.FileUtil.access(p)) {
|
|
480
|
+
p = await FileUtil_1.FileUtil.getUniqueFileName(p);
|
|
481
|
+
}
|
|
482
|
+
await this.cut_exec(sysPath, p);
|
|
483
|
+
return (0, Result_1.Sucess)("1");
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
const stats = await FileUtil_1.FileUtil.statSync(sysPath);
|
|
487
|
+
if (stats.isFile()) {
|
|
488
|
+
await FileUtil_1.FileUtil.unlinkSync(sysPath);
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
await (0, rimraf_1.rimraf)(sysPath);
|
|
492
|
+
}
|
|
493
|
+
return (0, Result_1.Sucess)("1");
|
|
494
|
+
}
|
|
495
|
+
async save(token, context, filePath) {
|
|
496
|
+
if (context === null || context === undefined) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
let sysPath = decodeURIComponent(filePath);
|
|
500
|
+
if ((0, path_util_1.isAbsolutePath)(sysPath)) {
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), sysPath);
|
|
504
|
+
}
|
|
505
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
506
|
+
user_service_1.userService.check_user_only_path(token, sysPath);
|
|
507
|
+
await FileUtil_1.FileUtil.writeFileSyncWithUtf8bom(sysPath, context);
|
|
508
|
+
}
|
|
509
|
+
async common_base64_save(token, filepath, base64_context, type) {
|
|
510
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), filepath);
|
|
511
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
512
|
+
user_service_1.userService.check_user_only_path(token, sysPath);
|
|
513
|
+
const binaryData = Buffer.from(base64_context, 'base64');
|
|
514
|
+
if (type === file_pojo_1.base64UploadType.all || type === file_pojo_1.base64UploadType.start) {
|
|
515
|
+
await FileUtil_1.FileUtil.writeFileSync(sysPath, binaryData);
|
|
516
|
+
}
|
|
517
|
+
else if (type === file_pojo_1.base64UploadType.part) {
|
|
518
|
+
await FileUtil_1.FileUtil.appendFileSync(sysPath, binaryData);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
async cut(token, data) {
|
|
522
|
+
if (!data) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
const root_path = setting_service_1.settingService.getFileRootPath(token);
|
|
526
|
+
const sysPath = path_1.default.join(root_path);
|
|
527
|
+
const toSysPath = path_1.default.join(root_path, data.to ? decodeURIComponent(data.to) : "");
|
|
528
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
529
|
+
user_service_1.userService.check_user_path(token, toSysPath);
|
|
530
|
+
for (const file of data.files) {
|
|
531
|
+
await this.cut_exec(decodeURIComponent(path_1.default.join(sysPath, file)), decodeURIComponent(path_1.default.join(toSysPath, path_1.default.basename(file))));
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
async cut_exec(source_path, to_file) {
|
|
535
|
+
await FileUtil_1.FileUtil.renameSync(source_path, to_file);
|
|
536
|
+
await (0, rimraf_1.rimraf)(source_path);
|
|
537
|
+
}
|
|
538
|
+
async copy(token, data) {
|
|
539
|
+
if (!data) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
const root_path = setting_service_1.settingService.getFileRootPath(token);
|
|
543
|
+
const sysPath = path_1.default.join(root_path);
|
|
544
|
+
const toSysPath = path_1.default.join(root_path, data.to ? decodeURIComponent(data.to) : "");
|
|
545
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
546
|
+
user_service_1.userService.check_user_only_path(token, sysPath);
|
|
547
|
+
user_service_1.userService.check_user_path(token, toSysPath);
|
|
548
|
+
user_service_1.userService.check_user_only_path(token, toSysPath);
|
|
549
|
+
for (const file of data.files) {
|
|
550
|
+
const filePath = decodeURIComponent(path_1.default.join(sysPath, file));
|
|
551
|
+
await fs_extra_1.default.copy(filePath, decodeURIComponent(path_1.default.join(toSysPath, path_1.default.basename(file))), { overwrite: true });
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
async newFile(token, data) {
|
|
555
|
+
await this.todoNew(token, 2, data);
|
|
556
|
+
}
|
|
557
|
+
async newDir(token, data) {
|
|
558
|
+
await this.todoNew(token, 1, data);
|
|
559
|
+
}
|
|
560
|
+
async todoNew(token, type, data) {
|
|
561
|
+
if (data === null || data === undefined) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), decodeURIComponent(data.name));
|
|
565
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
566
|
+
user_service_1.userService.check_user_only_path(token, sysPath);
|
|
567
|
+
if (await FileUtil_1.FileUtil.access(sysPath)) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (type === 1) {
|
|
571
|
+
await FileUtil_1.FileUtil.mkdirSync(sysPath, { recursive: true });
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
await FileUtil_1.FileUtil.writeFileSync(sysPath, data.context ?? "");
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
async rename(token, data) {
|
|
578
|
+
if (!data) {
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
const root_path = setting_service_1.settingService.getFileRootPath(token);
|
|
582
|
+
const sysPath = path_1.default.join(root_path, decodeURIComponent(data.name));
|
|
583
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
584
|
+
const sysPathNew = path_1.default.join(root_path, decodeURIComponent(data.newName));
|
|
585
|
+
await fs_extra_1.default.rename(sysPath, sysPathNew);
|
|
586
|
+
}
|
|
587
|
+
download_one_file(file_name, file_size, file_path, res, param) {
|
|
588
|
+
const encodedFileName = encodeURIComponent(file_name).replace(/%20/g, '+');
|
|
589
|
+
let handle_type = "";
|
|
590
|
+
if (param?.handle_type_ !== undefined) {
|
|
591
|
+
handle_type = param.handle_type_;
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
handle_type = "attachment";
|
|
595
|
+
if (file_name.endsWith('.pdf')) {
|
|
596
|
+
handle_type = "inline";
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
res.set({
|
|
600
|
+
"Content-Type": mime.lookup(file_name) || "application/octet-stream",
|
|
601
|
+
"Content-Length": file_size,
|
|
602
|
+
"Content-Disposition": `${handle_type}; filename="${encodedFileName}"; filename*=UTF-8''${encodedFileName}`
|
|
603
|
+
});
|
|
604
|
+
if (param?.cache) {
|
|
605
|
+
res.setHeader('Cache-Control', 'public, max-age=86400 ');
|
|
606
|
+
}
|
|
607
|
+
else if (param?.cache_length) {
|
|
608
|
+
res.setHeader('Cache-Control', `public, max-age=${param.cache_length}`);
|
|
609
|
+
}
|
|
610
|
+
const readStream = fs_1.default.createReadStream(file_path);
|
|
611
|
+
readStream.pipe(res);
|
|
612
|
+
}
|
|
613
|
+
async download_for_private(ctx) {
|
|
614
|
+
let file = ctx.query.file;
|
|
615
|
+
if (!file || !file.length) {
|
|
616
|
+
ctx.res.status(404).send('File not found');
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const token = ctx.query['token'];
|
|
620
|
+
const cache = ctx.query['cache'];
|
|
621
|
+
const show = ctx.query['show'];
|
|
622
|
+
const range = ctx.header("Range");
|
|
623
|
+
const res = ctx.res;
|
|
624
|
+
if (!Array.isArray(file)) {
|
|
625
|
+
const p = decodeURIComponent(file);
|
|
626
|
+
if ((0, path_util_1.isAbsolutePath)(p)) {
|
|
627
|
+
file = p;
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
file = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), decodeURIComponent(file));
|
|
631
|
+
}
|
|
632
|
+
user_service_1.userService.check_user_path(token, file);
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
const files = file;
|
|
636
|
+
const new_files = [];
|
|
637
|
+
for (const file of files) {
|
|
638
|
+
let sysPath = decodeURIComponent(file);
|
|
639
|
+
if ((0, path_util_1.isAbsolutePath)(sysPath)) {
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), sysPath);
|
|
643
|
+
}
|
|
644
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
645
|
+
new_files.push(sysPath);
|
|
646
|
+
}
|
|
647
|
+
file = new_files;
|
|
648
|
+
}
|
|
649
|
+
this.download({ file, token, cache, show, range, res });
|
|
650
|
+
}
|
|
651
|
+
async download_for_public(ctx) {
|
|
652
|
+
const file = ctx.query.file;
|
|
653
|
+
if (!file || !file.length) {
|
|
654
|
+
ctx.res.status(404).send('File not found');
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const cache = ctx.query['cache'];
|
|
658
|
+
const show = ctx.query['show'];
|
|
659
|
+
const range = ctx.header("Range");
|
|
660
|
+
const res = ctx.res;
|
|
661
|
+
const share_id = ctx.query['share_id'];
|
|
662
|
+
const share_token = ctx.query['share_token'];
|
|
663
|
+
const list = setting_service_1.settingService.get_share_file_list();
|
|
664
|
+
let item;
|
|
665
|
+
for (const i of list) {
|
|
666
|
+
if (i.id === share_id) {
|
|
667
|
+
const statics = DataUtil_1.DataUtil.get(data_type_1.data_common_key.share_file_list_key_download_statics, data_type_1.file_key.statics_tag) ?? {};
|
|
668
|
+
statics[i.id] = (statics[i.id] ?? 0) + 1;
|
|
669
|
+
DataUtil_1.DataUtil.set(data_type_1.data_common_key.share_file_list_key_download_statics, statics, data_type_1.file_key.statics_tag);
|
|
670
|
+
item = i;
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (!item) {
|
|
675
|
+
res.status(400).send("未知分享");
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
if (item.token) {
|
|
679
|
+
if (item.token !== share_token) {
|
|
680
|
+
res.status(400).send("token错误");
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
this.download({ file, cache, show, range, res });
|
|
685
|
+
}
|
|
686
|
+
async download({ file, cache, show, range, res }) {
|
|
687
|
+
if (!Array.isArray(file)) {
|
|
688
|
+
const sysPath = decodeURIComponent(file);
|
|
689
|
+
const fileName = path_1.default.basename(sysPath);
|
|
690
|
+
const stats = await FileUtil_1.FileUtil.statSync(sysPath);
|
|
691
|
+
const fileSize = stats.size;
|
|
692
|
+
if (range) {
|
|
693
|
+
const encodedFileName = encodeURIComponent(fileName).replace(/%20/g, '+');
|
|
694
|
+
const [start, end] = range.replace(/bytes=/, "").split("-");
|
|
695
|
+
const startByte = parseInt(start, 10);
|
|
696
|
+
const endByte = end ? parseInt(end, 10) : fileSize - 1;
|
|
697
|
+
if (startByte >= fileSize) {
|
|
698
|
+
res.status(416).send("Requested range not satisfiable");
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const chunkSize = endByte - startByte + 1;
|
|
702
|
+
const readStream = fs_1.default.createReadStream(sysPath, { start: startByte, end: endByte });
|
|
703
|
+
res.status(206);
|
|
704
|
+
res.set({
|
|
705
|
+
"Content-Range": `bytes ${startByte}-${endByte}/${fileSize}`,
|
|
706
|
+
"Accept-Ranges": "bytes",
|
|
707
|
+
"Content-Length": chunkSize,
|
|
708
|
+
"Content-Type": mime.lookup(fileName) || "application/octet-stream",
|
|
709
|
+
"Content-Disposition": `attachment; filename="${encodedFileName}"; filename*=UTF-8''${encodedFileName}`
|
|
710
|
+
});
|
|
711
|
+
readStream.pipe(res);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
if (stats.isFile()) {
|
|
715
|
+
this.download_one_file(fileName, fileSize, sysPath, res, {
|
|
716
|
+
cache: cache === "1",
|
|
717
|
+
handle_type_: show === "1" ? "inline" : "attachment"
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
res.attachment(path_1.default.basename(sysPath) + ".zip");
|
|
722
|
+
const archive = archiver('zip', { zlib: { level: 5 } });
|
|
723
|
+
archive.pipe(res);
|
|
724
|
+
archive.directory(sysPath, path_1.default.basename(sysPath));
|
|
725
|
+
archive.finalize();
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
const files = file;
|
|
730
|
+
const archive = archiver('zip', {
|
|
731
|
+
zlib: { level: 5 }
|
|
732
|
+
});
|
|
733
|
+
res.attachment("output.zip");
|
|
734
|
+
res.set('Content-Type', 'application/octet-stream');
|
|
735
|
+
archive.pipe(res);
|
|
736
|
+
for (const file of files) {
|
|
737
|
+
const sysPath = decodeURIComponent(file);
|
|
738
|
+
const stats = await FileUtil_1.FileUtil.statSync(sysPath);
|
|
739
|
+
if (stats.isFile()) {
|
|
740
|
+
archive.file(sysPath, { name: path_1.default.basename(sysPath) });
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
archive.directory(sysPath, path_1.default.basename(sysPath));
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
archive.finalize();
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
async file_video_trans(data) {
|
|
750
|
+
const pojo = data.context;
|
|
751
|
+
user_service_1.userService.check_user_auth(pojo.token, user_req_1.UserAuth.filecat_file_context_update_upload_created_copy_decompression);
|
|
752
|
+
const wss = data.wss;
|
|
753
|
+
const root_path = setting_service_1.settingService.getFileRootPath(pojo.token);
|
|
754
|
+
const sysPath = path_1.default.join(root_path, decodeURIComponent(pojo.source_filename));
|
|
755
|
+
const sysPathNew = path_1.default.join(root_path, decodeURIComponent(pojo.to_filename));
|
|
756
|
+
(await setting_service_1.settingService.getFfmpeg())(sysPath)
|
|
757
|
+
.toFormat(pojo.to_format)
|
|
758
|
+
.on('start', function (commandLine) {
|
|
759
|
+
const result = new WsData_1.WsData(WsData_1.CmdType.file_video_trans_progress);
|
|
760
|
+
result.context = 0;
|
|
761
|
+
wss.sendData(result.encode());
|
|
762
|
+
})
|
|
763
|
+
.on('progress', function (progress) {
|
|
764
|
+
const result = new WsData_1.WsData(WsData_1.CmdType.file_video_trans_progress);
|
|
765
|
+
result.context = progress.percent.toFixed(0);
|
|
766
|
+
wss.sendData(result.encode());
|
|
767
|
+
})
|
|
768
|
+
.on('error', function (err, stdout, stderr) {
|
|
769
|
+
wss.ws.close();
|
|
770
|
+
})
|
|
771
|
+
.on('end', function () {
|
|
772
|
+
const result = new WsData_1.WsData(WsData_1.CmdType.file_video_trans_progress);
|
|
773
|
+
result.context = 100;
|
|
774
|
+
wss.sendData(result.encode());
|
|
775
|
+
})
|
|
776
|
+
.save(sysPathNew);
|
|
777
|
+
}
|
|
778
|
+
async uncompress(data) {
|
|
779
|
+
const pojo = data.context;
|
|
780
|
+
user_service_1.userService.check_user_auth(pojo.token, user_req_1.UserAuth.filecat_file_context_update_upload_created_copy_decompression);
|
|
781
|
+
const source_file = decodeURIComponent(pojo.source_file);
|
|
782
|
+
const tar_dir = decodeURIComponent(pojo.tar_dir ?? "");
|
|
783
|
+
const directoryPath = decodeURIComponent(path_1.default.dirname(source_file));
|
|
784
|
+
const root_path = setting_service_1.settingService.getFileRootPath(pojo.token);
|
|
785
|
+
const targetFolder = path_1.default.join(root_path, directoryPath, tar_dir);
|
|
786
|
+
user_service_1.userService.check_user_path(pojo.token, targetFolder);
|
|
787
|
+
user_service_1.userService.check_user_only_path(pojo.token, targetFolder);
|
|
788
|
+
const wss = data.wss;
|
|
789
|
+
if (tar_dir) {
|
|
790
|
+
await FileUtil_1.FileUtil.mkdirSync(path_1.default.join(targetFolder), { recursive: true });
|
|
791
|
+
}
|
|
792
|
+
const sysSourcePath = path_1.default.join(root_path, source_file);
|
|
793
|
+
user_service_1.userService.check_user_path(pojo.token, sysSourcePath);
|
|
794
|
+
const outHanle = (value) => {
|
|
795
|
+
if (value === -1) {
|
|
796
|
+
wss.ws.close();
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const result = new WsData_1.WsData(WsData_1.CmdType.file_uncompress_progress);
|
|
800
|
+
result.context = value;
|
|
801
|
+
wss.sendData(result.encode());
|
|
802
|
+
};
|
|
803
|
+
await file_compress_1.fileCompress.handle_un(pojo.format, sysSourcePath, targetFolder, outHanle);
|
|
804
|
+
}
|
|
805
|
+
async FileCompress(data) {
|
|
806
|
+
const pojo = data.context;
|
|
807
|
+
user_service_1.userService.check_user_auth(pojo.token, user_req_1.UserAuth.filecat_file_context_update_upload_created_copy_decompression);
|
|
808
|
+
const files = pojo.filePaths;
|
|
809
|
+
const root_path = setting_service_1.settingService.getFileRootPath(pojo.token);
|
|
810
|
+
const wss = data.wss;
|
|
811
|
+
const filePaths = [], directorys = [];
|
|
812
|
+
for (const file of files) {
|
|
813
|
+
const name = path_1.default.join(root_path, decodeURIComponent(file));
|
|
814
|
+
user_service_1.userService.check_user_path(pojo.token, name);
|
|
815
|
+
user_service_1.userService.check_user_only_path(pojo.token, name);
|
|
816
|
+
try {
|
|
817
|
+
const stats = await FileUtil_1.FileUtil.statSync(name);
|
|
818
|
+
if (stats.isFile()) {
|
|
819
|
+
filePaths.push(name);
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
directorys.push(name);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
catch (e) {
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
const targerFilePath = path_1.default.join(root_path, decodeURIComponent(pojo.tar_filename));
|
|
829
|
+
const handle_progress = (value) => {
|
|
830
|
+
{
|
|
831
|
+
if (value === -1) {
|
|
832
|
+
wss.ws.close();
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
const result = new WsData_1.WsData(WsData_1.CmdType.file_compress_progress);
|
|
836
|
+
result.context = value;
|
|
837
|
+
wss.sendData(result.encode());
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
let format;
|
|
841
|
+
switch (pojo.format) {
|
|
842
|
+
case file_pojo_1.FileCompressType.tar:
|
|
843
|
+
format = "tar";
|
|
844
|
+
break;
|
|
845
|
+
case file_pojo_1.FileCompressType.gz:
|
|
846
|
+
await file_compress_1.fileCompress.compressGz(pojo.compress_level, targerFilePath, filePaths, directorys, handle_progress);
|
|
847
|
+
return;
|
|
848
|
+
case file_pojo_1.FileCompressType.rar:
|
|
849
|
+
return;
|
|
850
|
+
case file_pojo_1.FileCompressType.zip:
|
|
851
|
+
format = "zip";
|
|
852
|
+
break;
|
|
853
|
+
case file_pojo_1.FileCompressType.tar_gz:
|
|
854
|
+
format = "tar";
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
857
|
+
await file_compress_1.fileCompress.compress(format, pojo.compress_level, targerFilePath, filePaths, directorys, handle_progress, pojo.format === file_pojo_1.FileCompressType.tar_gz);
|
|
858
|
+
}
|
|
859
|
+
async studio_get_item(param_path, token) {
|
|
860
|
+
const result = {
|
|
861
|
+
list: []
|
|
862
|
+
};
|
|
863
|
+
const sysPath = path_1.default.join(setting_service_1.settingService.getFileRootPath(token), param_path ? decodeURIComponent(param_path) : "");
|
|
864
|
+
user_service_1.userService.check_user_path(token, sysPath);
|
|
865
|
+
if (!await FileUtil_1.FileUtil.access(sysPath)) {
|
|
866
|
+
return (0, Result_1.Fail)("路径不存在", Result_pojo_1.RCode.Fail);
|
|
867
|
+
}
|
|
868
|
+
const stats = await FileUtil_1.FileUtil.statSync(sysPath);
|
|
869
|
+
if (stats.isFile()) {
|
|
870
|
+
return (0, Result_1.Fail)("是文件", Result_pojo_1.RCode.Fail);
|
|
871
|
+
}
|
|
872
|
+
const items = await FileUtil_1.FileUtil.readdirSync(sysPath);
|
|
873
|
+
for (const item of items) {
|
|
874
|
+
const filePath = path_1.default.join(sysPath, item);
|
|
875
|
+
let stats = null;
|
|
876
|
+
try {
|
|
877
|
+
stats = await FileUtil_1.FileUtil.statSync(filePath);
|
|
878
|
+
}
|
|
879
|
+
catch (e) {
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
result.list.push({
|
|
883
|
+
type: stats.isFile() ? "file" : "folder",
|
|
884
|
+
name: item,
|
|
885
|
+
size: stats.size
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
return result;
|
|
889
|
+
}
|
|
890
|
+
async getDiskSizeForPath(fpath) {
|
|
891
|
+
const pojo = {};
|
|
892
|
+
try {
|
|
893
|
+
const diskData = await systeminformation_1.default.fsSize();
|
|
894
|
+
const dirPath = path_1.default.resolve(fpath);
|
|
895
|
+
let targetDisk;
|
|
896
|
+
diskData.forEach(disk => {
|
|
897
|
+
if (dirPath.startsWith(disk.mount)) {
|
|
898
|
+
if (!targetDisk) {
|
|
899
|
+
targetDisk = disk;
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
if (disk.mount.length > targetDisk.mount.length) {
|
|
904
|
+
targetDisk = disk;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
if (targetDisk) {
|
|
910
|
+
pojo.path = dirPath;
|
|
911
|
+
pojo.name = path_1.default.basename(fpath);
|
|
912
|
+
pojo.total_size = (0, ValueUtil_1.formatFileSize)(targetDisk.size);
|
|
913
|
+
pojo.left_size = (0, ValueUtil_1.formatFileSize)(targetDisk.available);
|
|
914
|
+
pojo.fs_type = targetDisk.type;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
catch (error) {
|
|
918
|
+
console.error('Error fetching disk information:', error);
|
|
919
|
+
return pojo;
|
|
920
|
+
}
|
|
921
|
+
return pojo;
|
|
922
|
+
}
|
|
923
|
+
isFirstByte(byte, encoding = "utf8") {
|
|
924
|
+
if (byte === undefined || byte < 0 || byte > 255)
|
|
925
|
+
throw 'Invalid byte';
|
|
926
|
+
switch (encoding.toLowerCase()) {
|
|
927
|
+
case 'utf8':
|
|
928
|
+
case 'utf-8':
|
|
929
|
+
return (byte & 0xE0) === 0xC0 || (byte & 0xF0) === 0xE0 || (byte & 0xF8) === 0xF0;
|
|
930
|
+
case 'ascii':
|
|
931
|
+
case 'latin1':
|
|
932
|
+
case 'iso-8859-1':
|
|
933
|
+
case 'windows-1252':
|
|
934
|
+
return true;
|
|
935
|
+
case 'gbk':
|
|
936
|
+
case 'gb2312':
|
|
937
|
+
return byte >= 0x81 && byte <= 0xFE;
|
|
938
|
+
case 'big5':
|
|
939
|
+
return byte >= 0x81 && byte <= 0xFE;
|
|
940
|
+
default:
|
|
941
|
+
throw 'Unsupported encoding for isFirstByte';
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
convertToUtf8(input, fromEncoding) {
|
|
945
|
+
if (fromEncoding === 'utf8' || fromEncoding === 'utf-8') {
|
|
946
|
+
return Buffer.isBuffer(input) ? input.toString('utf8') : input;
|
|
947
|
+
}
|
|
948
|
+
let buf;
|
|
949
|
+
if (typeof input === 'string') {
|
|
950
|
+
buf = iconv.encode(input, fromEncoding);
|
|
951
|
+
}
|
|
952
|
+
else if (Buffer.isBuffer(input)) {
|
|
953
|
+
buf = input;
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
throw new Error('输入必须是 Buffer 或字符串');
|
|
957
|
+
}
|
|
958
|
+
const str = iconv.decode(buf, fromEncoding);
|
|
959
|
+
return str;
|
|
960
|
+
}
|
|
961
|
+
async go_forward_log(pojo, file_path) {
|
|
962
|
+
let linesRead = 0;
|
|
963
|
+
let haveReadSize = 0;
|
|
964
|
+
const fd = await FileUtil_1.FileUtil.open(file_path, "r");
|
|
965
|
+
let max_count = 100;
|
|
966
|
+
while (haveReadSize < pojo.once_max_size) {
|
|
967
|
+
if (max_count <= 0) {
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
max_count--;
|
|
971
|
+
const buffer = Buffer.alloc(10240);
|
|
972
|
+
let { bytesRead } = await fd.read(buffer, 0, buffer.length, pojo.position);
|
|
973
|
+
let done = false;
|
|
974
|
+
let last_h = -1;
|
|
975
|
+
for (let i = 0, ch_byte_i = bytesRead - 1; i < bytesRead; i++) {
|
|
976
|
+
if (buffer[i] === 10 || i === ch_byte_i) {
|
|
977
|
+
let index = i;
|
|
978
|
+
if (i === ch_byte_i && (buffer[i] & 0x80) !== 0) {
|
|
979
|
+
for (let j = i; j > last_h; j--) {
|
|
980
|
+
if (this.isFirstByte(buffer[j], pojo.encoding)) {
|
|
981
|
+
index = j - 1;
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
linesRead++;
|
|
987
|
+
const now_str_start = last_h + 1;
|
|
988
|
+
const next_str_start = index + 1;
|
|
989
|
+
pojo.context_list.push(this.convertToUtf8(buffer.subarray(now_str_start, next_str_start), pojo.encoding));
|
|
990
|
+
pojo.context_start_position_list.push(pojo.position + now_str_start);
|
|
991
|
+
pojo.context_position_list.push(pojo.position + next_str_start);
|
|
992
|
+
if (linesRead >= pojo.line) {
|
|
993
|
+
done = true;
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
last_h = index;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
if (done || bytesRead === 0) {
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
haveReadSize += last_h;
|
|
1004
|
+
pojo.position += last_h + 1;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
await fd.close();
|
|
1008
|
+
return pojo;
|
|
1009
|
+
}
|
|
1010
|
+
async find_back_enter_index(pojo, file_path, max_len = 10240) {
|
|
1011
|
+
const fd = await FileUtil_1.FileUtil.open(file_path, "r");
|
|
1012
|
+
let buffer_len = max_len;
|
|
1013
|
+
if (pojo.position < buffer_len) {
|
|
1014
|
+
buffer_len = pojo.position;
|
|
1015
|
+
}
|
|
1016
|
+
let buffer = Buffer.alloc(buffer_len);
|
|
1017
|
+
const position = pojo.position - buffer.length;
|
|
1018
|
+
const { bytesRead } = await fd.read(buffer, 0, buffer.length, position);
|
|
1019
|
+
for (let i = bytesRead; i >= 0; i--) {
|
|
1020
|
+
let index = i;
|
|
1021
|
+
if (buffer[i] === 10 || i === 0) {
|
|
1022
|
+
if ((buffer[i] & 0x80) !== 0) {
|
|
1023
|
+
for (let j = 0; j < bytesRead; j++) {
|
|
1024
|
+
if (this.isFirstByte(buffer[j], pojo.encoding)) {
|
|
1025
|
+
index = j - 1;
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
const now_str_start = index === 0 && pojo.position === 0 ? 0 : index + 1;
|
|
1031
|
+
pojo.position = position + now_str_start;
|
|
1032
|
+
await fd.close();
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
await fd.close();
|
|
1037
|
+
pojo.position = position;
|
|
1038
|
+
}
|
|
1039
|
+
async go_back_log(pojo, file_path) {
|
|
1040
|
+
let linesRead = 0;
|
|
1041
|
+
let haveReadSize = 0;
|
|
1042
|
+
const fd = await FileUtil_1.FileUtil.open(file_path, "r");
|
|
1043
|
+
let buffer_len = 10240;
|
|
1044
|
+
let max_count = 100;
|
|
1045
|
+
while (haveReadSize < pojo.once_max_size) {
|
|
1046
|
+
if (max_count <= 0) {
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
max_count--;
|
|
1050
|
+
if (pojo.position < buffer_len) {
|
|
1051
|
+
buffer_len = pojo.position;
|
|
1052
|
+
}
|
|
1053
|
+
let buffer = Buffer.alloc(buffer_len);
|
|
1054
|
+
pojo.position = pojo.position - buffer.length;
|
|
1055
|
+
const { bytesRead } = await fd.read(buffer, 0, buffer.length, pojo.position);
|
|
1056
|
+
let done = false;
|
|
1057
|
+
let last_h = bytesRead;
|
|
1058
|
+
for (let i = bytesRead; i >= 0; i--) {
|
|
1059
|
+
let index = i;
|
|
1060
|
+
if (buffer[i] === 10 || i === 0) {
|
|
1061
|
+
if (i === 0 && pojo.position !== 0 && (buffer[i] & 0x80) !== 0) {
|
|
1062
|
+
for (let j = 0; j < last_h; j++) {
|
|
1063
|
+
if (this.isFirstByte(buffer[j], pojo.encoding)) {
|
|
1064
|
+
index = j - 1;
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
linesRead++;
|
|
1070
|
+
const now_str_start = index === 0 && pojo.position === 0 ? 0 : index + 1;
|
|
1071
|
+
const next_str_start = last_h + 1;
|
|
1072
|
+
pojo.context_list.push(this.convertToUtf8(buffer.subarray(now_str_start, next_str_start), pojo.encoding));
|
|
1073
|
+
pojo.context_start_position_list.push(pojo.position + now_str_start);
|
|
1074
|
+
pojo.context_position_list.push(pojo.position + next_str_start);
|
|
1075
|
+
if (linesRead >= pojo.line) {
|
|
1076
|
+
done = true;
|
|
1077
|
+
break;
|
|
1078
|
+
}
|
|
1079
|
+
last_h = index;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
if (done || bytesRead === 0 || (last_h <= 0 && pojo.position === 0)) {
|
|
1083
|
+
break;
|
|
1084
|
+
}
|
|
1085
|
+
else {
|
|
1086
|
+
haveReadSize += (bytesRead - last_h);
|
|
1087
|
+
pojo.position -= last_h - 1;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
await fd.close();
|
|
1091
|
+
return pojo;
|
|
1092
|
+
}
|
|
1093
|
+
async log_viewer(data) {
|
|
1094
|
+
const pojo = data.context;
|
|
1095
|
+
pojo.context = "";
|
|
1096
|
+
pojo.context_list = [];
|
|
1097
|
+
pojo.context_position_list = [];
|
|
1098
|
+
pojo.context_start_position_list = [];
|
|
1099
|
+
const root_path = setting_service_1.settingService.getFileRootPath(pojo.token);
|
|
1100
|
+
const file_path = path_1.default.join(root_path, decodeURIComponent(pojo.path));
|
|
1101
|
+
user_service_1.userService.check_user_path(data.wss.token, file_path);
|
|
1102
|
+
const stats = await FileUtil_1.FileUtil.statSync(file_path);
|
|
1103
|
+
const fileSize = stats.size;
|
|
1104
|
+
pojo.max_size = fileSize;
|
|
1105
|
+
if ((pojo.position <= 0 && pojo.back) || (!pojo.back && pojo.position >= fileSize)) {
|
|
1106
|
+
pojo.context = '';
|
|
1107
|
+
return pojo;
|
|
1108
|
+
}
|
|
1109
|
+
if (pojo.back)
|
|
1110
|
+
return this.go_back_log(pojo, file_path);
|
|
1111
|
+
if (pojo.find_back_enter_index)
|
|
1112
|
+
await this.find_back_enter_index(pojo, file_path, 100);
|
|
1113
|
+
return this.go_forward_log(pojo, file_path);
|
|
1114
|
+
}
|
|
1115
|
+
log_viewer_watch_cancel(data) {
|
|
1116
|
+
this.file_change_watcher_map.delete(data.wss.token);
|
|
1117
|
+
}
|
|
1118
|
+
log_viewer_watch(data) {
|
|
1119
|
+
const pojo = data.context;
|
|
1120
|
+
if (this.file_change_watcher_map.has(data.wss.token)) {
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
const wss = data.wss;
|
|
1124
|
+
pojo.context = "";
|
|
1125
|
+
pojo.context_list = [];
|
|
1126
|
+
pojo.context_position_list = [];
|
|
1127
|
+
pojo.context_start_position_list = [];
|
|
1128
|
+
const root_path = setting_service_1.settingService.getFileRootPath(data.wss.token);
|
|
1129
|
+
const file_path = path_1.default.join(root_path, decodeURIComponent(pojo.path));
|
|
1130
|
+
user_service_1.userService.check_user_path(wss.token, file_path);
|
|
1131
|
+
let watcher = chokidar.watch(file_path, {
|
|
1132
|
+
persistent: true,
|
|
1133
|
+
usePolling: true,
|
|
1134
|
+
});
|
|
1135
|
+
this.file_change_watcher_map.set(data.wss.token, watcher);
|
|
1136
|
+
wss.setClose(() => {
|
|
1137
|
+
watcher.close();
|
|
1138
|
+
this.file_change_watcher_map.delete(data.wss.token);
|
|
1139
|
+
});
|
|
1140
|
+
let bytesRead = pojo.max_size;
|
|
1141
|
+
watcher.on('change', (changedFilePath) => {
|
|
1142
|
+
if (changedFilePath === file_path) {
|
|
1143
|
+
if (!this.file_change_watcher_map.has(data.wss.token)) {
|
|
1144
|
+
watcher.close();
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
fs_1.default.stat(file_path, (err, stats) => {
|
|
1148
|
+
if (err) {
|
|
1149
|
+
console.error('Failed to get file stats:', err);
|
|
1150
|
+
watcher.close();
|
|
1151
|
+
this.file_change_watcher_map.delete(data.wss.token);
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
if (stats.size > bytesRead) {
|
|
1155
|
+
const newStream = fs_1.default.createReadStream(file_path, { encoding: 'utf8', start: bytesRead });
|
|
1156
|
+
newStream.on('data', (chunk) => {
|
|
1157
|
+
const str = chunk.toString();
|
|
1158
|
+
let now_str_start = bytesRead;
|
|
1159
|
+
let next_str_start = bytesRead + chunk.length + 1;
|
|
1160
|
+
let index = 0;
|
|
1161
|
+
for (let i = 0; i < str.length; i++) {
|
|
1162
|
+
if (!/^\s$/.test(str[i])) {
|
|
1163
|
+
break;
|
|
1164
|
+
}
|
|
1165
|
+
else if (str[i] === '\n' && chunk.length - 1 > i) {
|
|
1166
|
+
index = i + 1;
|
|
1167
|
+
now_str_start = bytesRead + index;
|
|
1168
|
+
next_str_start + index;
|
|
1169
|
+
break;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
pojo.context_list.push(str.slice(index, chunk.length));
|
|
1173
|
+
pojo.context_start_position_list.push(now_str_start);
|
|
1174
|
+
pojo.context_position_list.push(next_str_start);
|
|
1175
|
+
pojo.max_size = bytesRead + chunk.length;
|
|
1176
|
+
const result = new WsData_1.WsData(WsData_1.CmdType.log_viewer_watch);
|
|
1177
|
+
result.context = pojo;
|
|
1178
|
+
wss.sendData(result.encode());
|
|
1179
|
+
bytesRead += Buffer.byteLength(chunk, 'utf8');
|
|
1180
|
+
pojo.context_list = [];
|
|
1181
|
+
pojo.context_position_list = [];
|
|
1182
|
+
pojo.context_start_position_list = [];
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
watcher.on('error', (error) => {
|
|
1189
|
+
watcher.close();
|
|
1190
|
+
this.file_change_watcher_map.delete(data.wss.token);
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
async get_share_info(id, token) {
|
|
1194
|
+
const list = setting_service_1.settingService.get_share_file_list();
|
|
1195
|
+
let item;
|
|
1196
|
+
for (const i of list) {
|
|
1197
|
+
if (i.id === id) {
|
|
1198
|
+
item = i;
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
if (!item)
|
|
1203
|
+
throw "未知分享";
|
|
1204
|
+
if (item.token) {
|
|
1205
|
+
if (token !== item.token) {
|
|
1206
|
+
return (0, Result_1.Sucess)("", Result_pojo_1.RCode.need_token_share);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
const result = {
|
|
1210
|
+
is_dir: true,
|
|
1211
|
+
files: []
|
|
1212
|
+
};
|
|
1213
|
+
const sysPath = decodeURIComponent(item.path);
|
|
1214
|
+
const stats = await FileUtil_1.FileUtil.statSync(item.path);
|
|
1215
|
+
if (stats.isFile()) {
|
|
1216
|
+
result.is_dir = false;
|
|
1217
|
+
const mtime = stats ? new Date(stats.mtime).getTime() : 0;
|
|
1218
|
+
const name = path_1.default.basename(sysPath);
|
|
1219
|
+
const pojo = {
|
|
1220
|
+
type: (0, FileMenuType_1.getFileFormat)(name),
|
|
1221
|
+
name: name,
|
|
1222
|
+
mtime: mtime,
|
|
1223
|
+
size: stats.size,
|
|
1224
|
+
isLink: stats?.isSymbolicLink(),
|
|
1225
|
+
path: sysPath
|
|
1226
|
+
};
|
|
1227
|
+
result.files.push(pojo);
|
|
1228
|
+
}
|
|
1229
|
+
else {
|
|
1230
|
+
let items = await FileUtil_1.FileUtil.readdirSync(sysPath);
|
|
1231
|
+
const param_path = item.path;
|
|
1232
|
+
for (const item of items) {
|
|
1233
|
+
const filePath = path_1.default.join(sysPath, item);
|
|
1234
|
+
let stats = null;
|
|
1235
|
+
try {
|
|
1236
|
+
stats = await FileUtil_1.FileUtil.statSync(filePath);
|
|
1237
|
+
}
|
|
1238
|
+
catch (e) {
|
|
1239
|
+
console.log("读取错误", e);
|
|
1240
|
+
}
|
|
1241
|
+
let type;
|
|
1242
|
+
let p;
|
|
1243
|
+
let size;
|
|
1244
|
+
if (!stats)
|
|
1245
|
+
continue;
|
|
1246
|
+
if (stats.isFile()) {
|
|
1247
|
+
type = (0, FileMenuType_1.getFileFormat)(item);
|
|
1248
|
+
p = path_1.default.join(param_path, item);
|
|
1249
|
+
size = stats.size;
|
|
1250
|
+
}
|
|
1251
|
+
else if (stats.isDirectory()) {
|
|
1252
|
+
continue;
|
|
1253
|
+
}
|
|
1254
|
+
else {
|
|
1255
|
+
type = file_pojo_1.FileTypeEnum.dev;
|
|
1256
|
+
p = path_1.default.join(param_path, item);
|
|
1257
|
+
size = stats.size;
|
|
1258
|
+
}
|
|
1259
|
+
const mtime = stats ? new Date(stats.mtime).getTime() : 0;
|
|
1260
|
+
const pojo = {
|
|
1261
|
+
type,
|
|
1262
|
+
name: item,
|
|
1263
|
+
mtime: mtime,
|
|
1264
|
+
size,
|
|
1265
|
+
isLink: stats?.isSymbolicLink(),
|
|
1266
|
+
path: p
|
|
1267
|
+
};
|
|
1268
|
+
result.files.push(pojo);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
return (0, Result_1.Sucess)(result);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
exports.FileService = FileService;
|
|
1275
|
+
exports.FileServiceImpl = new FileService();
|
|
1276
|
+
//# sourceMappingURL=file.service.js.map
|