Multi-source intelligent switching system based on npm packet downloading

By designing a multi-source intelligent switching system, dynamically evaluate and select the best npm source for download, the problems of single source, slow download speed and poor stability in the existing npm package management system are solved, and efficient, stable and intelligent npm package download management is achieved.

CN119788654AActive Publication Date: 2025-04-08NANJING LIANCHUANG DIGITAL TECH CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411835993.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-08
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

The existing npm package management system has problems such as single source, slow download speed and poor stability, complex user operations, difficult management, and high update and maintenance costs.

Method used

Design a multi-source intelligent switching system to dynamically evaluate and select the best npm source for download by monitoring the response time, download speed and stability of each npm source, realizing an automated and intelligent download process.

Benefits of technology

It significantly improves the efficiency and stability of npm package download, reduces user operation burden, reduces management complexity and update maintenance costs, and improves user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788654A_ABST
    Figure CN119788654A_ABST
Patent Text Reader

Abstract

A multi-source intelligent switching system based on npm packet downloading sets an evaluation mechanism and switching logic, monitors key indexes such as network conditions, source response time, downloading success rate and the like in real time, dynamically adjusts a switching strategy according to the data, monitors the average response time of each npm source to a request, and achieves the switching of the request. Comprising first response time and subsequent request response time; detecting the speed of downloading packets from each source in real time, evaluating the stability of the packets by recording the availability, success rate and error rate indexes of the sources, and outputting the stability to a console; the system continuously monitors the performance of each source in the downloading process, and adjusts the switching strategy in real time according to the actual situation; if the performance of the currently selected source is reduced or a fault occurs, the system can be immediately switched to an alternative source to ensure that a downloading task is not influenced; an efficient error processing and recovery mechanism is built in the system, and when an error or an abnormal condition occurs, a response is quickly made and recovery is tried or a new source is switched for downloading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software development and automation tools, and in particular to the field of download optimization and acceleration technology for npm package managers. Background Art

[0002] npm is a package manager for Node.js (JavaScript runtime). It is an open source command-line tool for installing, updating, and managing Node.js modules. npm is the official module manager for Node.js. It allows users to download and install public Node.js modules from a centralized repository and integrate these modules into their own applications. npm allows users to download and install public Node.js modules from the npm repository. Modules can be quickly installed using the npm command. npm provides the ability to manage modules, including upgrading and deleting modules. npm allows developers to publish their own modules to the npm repository for other developers to use.

[0003] The technology based on npm source download dependency has the following main disadvantages:

[0004] (1) High configuration complexity: Existing systems often require users to manually configure multiple npm sources and manually switch between them when using them, which increases the user's operational complexity. Users need to understand the characteristics and stability of each source in order to make a reasonable choice.

[0005] (2) Insufficient intelligence: Although some existing systems provide intelligent switching functions, their evaluation mechanisms and switching logic may not be precise and flexible enough to fully adapt to complex network environments and user needs.

[0006] (3) Lack of unified management configuration: Most existing systems lack a unified management configuration. Users need to use multiple tools or command line interfaces to manage npm sources and download tasks, which increases the difficulty and complexity of management.

[0007] (4) High update and maintenance costs: The existing system needs to be updated and maintained regularly to ensure the stability and security of its functions. However, with the rapid development and changes in the npm ecosystem, the cost of updating and maintaining the system may continue to increase. Summary of the invention

[0008] The purpose of this invention is to mainly solve the problems that may be encountered in the process of downloading npm packages, such as single source, slow download speed, poor stability, etc., and to achieve a more efficient package download experience by automatically switching multiple npm sources. The system is equipped with automation and intelligent decision-making capabilities, and can automatically select the best npm source for downloading according to preset rules or real-time network conditions. The automation and intelligent features greatly reduce the user's operating burden and improve download efficiency.

[0009] The technical solution of the present invention is: a multi-source intelligent switching system based on npm package download, which designs a more accurate evaluation mechanism and a more flexible switching logic, by monitoring the average response time of each npm source to requests, including the first response time and the response time of subsequent requests. The speed of downloading packages from each source is detected in real time, measured in KB / s, and its stability is evaluated by recording indicators such as the availability and error rate of the source and outputting them to the console; the results of the source are dynamically evaluated according to the current network environment, the priority of the download task, and the weight value of each source, and the optimal source is dynamically selected for downloading. The system continuously monitors the performance of each source during the download process, and adjusts the switching strategy in real time according to the actual situation.

[0010] If the currently selected source has performance degradation or failure, the system will immediately switch to the alternative source to ensure that the download task is not affected. The system has a built-in efficient error handling and recovery mechanism that can quickly respond and try to recover or switch to a new source for downloading when encountering errors or abnormal situations. This is to adapt to complex network environments and user needs. Through network smoothness, network speed and other aspects of detection, the source selection is intelligent and automated.

[0011] The present invention can significantly improve the user experience in the npm package management process by intelligently switching strategies, optimizing download speed and stability, and providing user-friendly configuration and configuration options. This improvement not only reduces the user's manual operation and time cost, but also improves the success rate and efficiency of download tasks, thereby enhancing user satisfaction.

[0012] npm multi-source download is an important part of the npm package management ecosystem. An efficient and intelligent download tool will promote the widespread dissemination and application of npm packages and promote the prosperity and development of the entire technology ecosystem. The system proposed in this application will inject new vitality and impetus into the npm package management ecosystem through its advanced technology and optimized user experience, and promote the emergence and application of more excellent npm packages.

[0013] Through intelligent switching strategies, optimized download speed and stability, and friendly user configuration and configuration options, the user experience in the process of npm package download management is improved. It improves the user's manual operation and time cost, improves the success rate and efficiency of download tasks, and enhances user satisfaction. The intelligent switching strategy can automatically select the best npm source for download according to the real-time network status and preset rules, effectively solving the problems of single source, slow download speed and poor stability. By monitoring the response time, download speed and stability of the source, the system can adjust the switching strategy in real time to ensure the efficient completion of the download task. By dynamically evaluating the performance of the source and the current network environment, the system can select the best download source to improve the download speed and stability. In addition, the system has a built-in efficient error handling and recovery mechanism, which can respond quickly and try to resume downloads when encountering abnormal situations, reduce the risk of download interruptions, and optimize download speed and stability. This system provides a simple and easy configuration method for users to conduct unified management and operation. This design reduces the difficulty and complexity of user management and improves management efficiency. Users can easily set the npm source download order, rules, and view download progress and log information. At the same time, the system also supports custom switching strategies, allowing users to flexibly configure according to their needs, improving the user experience.

[0014] By intelligently switching sources, the system of the present invention can also effectively avoid the problem of download interruption caused by single source failure. Although the system of the present invention is mainly oriented to automation and intelligence. The system of the present invention needs to provide a friendly configuration source file so that users can conveniently set the download order and rules, view download progress and log information, etc.

[0015] The present invention also aims to solve the following key technical problems: simplify the configuration process, provide a simple and easy-to-use configuration method, and easily add, delete and automatically switch npm sources according to rules, reducing the complexity of operation. Such as global installation path, cache path, personalized source address list and other information configuration.

[0016] The present invention improves the user experience in the process of npm package download management through intelligent switching strategy, optimization of download speed and stability, and provision of user-friendly configuration and configuration options. It improves the user's manual operation and time cost, improves the success rate and efficiency of download tasks, and enhances user satisfaction. The intelligent switching strategy can automatically select the best npm source for downloading according to the real-time network status and preset rules, effectively solving the problems of single source, slow download speed and poor stability. By monitoring the response time, download speed and stability of the source, the system can adjust the switching strategy in real time to ensure the efficient completion of the download task. By dynamically evaluating the performance of the source and the current network environment, the system can select the optimal download source to improve the download speed and stability. In addition, the system has a built-in efficient error handling and recovery mechanism, which can respond quickly and try to resume downloading when encountering abnormal situations, reduce the risk of download interruption, and optimize download speed and stability. The system of the present invention provides a simple and easy configuration method, which is convenient for users to carry out unified management and operation. This design reduces the management difficulty and complexity of users and improves management efficiency. Users can easily set the npm source download order, rules and view information such as download progress and logs. At the same time, the system also supports custom switching strategies, allowing users to flexibly configure according to their needs, improving the user experience.

[0017] The present invention improves the intelligence level: optimizes the system performance: improves the system architecture design, optimizes the resource allocation strategy, provides a fault-tolerant mechanism, and improves the reliability and availability of the system. Dynamically adjust the resource allocation strategy according to the current load and resource usage of the system. Increase resource investment during the peak period of download tasks to ensure the smooth progress of download tasks. Introduce a priority scheduling mechanism to allocate system resources according to the priority of download tasks. High-priority tasks can obtain more resource support, thereby completing the download faster. When an error occurs during the download process, the system should be able to automatically handle the error and attempt to retry. For example, when downloading from a certain source fails, the system can automatically switch to other sources for retrying. Provide a unified configuration: Develop a unified management configuration that integrates npm source management, download task monitoring, log viewing and other functions to facilitate users to perform unified management and operation.

[0018] Beneficial effects: 1) The present invention has a higher degree of intelligence. Compared with the prior art, it may only provide basic source switching functions and lacks intelligent evaluation mechanism and flexible switching logic.

[0019] This application introduces advanced artificial intelligence technology and develops a more accurate decision-making evaluation mechanism and more flexible switching logic. The system can monitor key indicators such as network status, source response time, download success rate, etc. in real time, and dynamically adjust the switching strategy based on these data. In addition, the system can learn users' downloading habits and preferences to provide a more personalized download experience. Including divergent thinking and avoidance solutions;

[0020] 2) Real-time monitoring and feedback

[0021] The present invention proposes: The system has a real-time monitoring function, which can continuously track the execution of download tasks and system performance. At the same time, the system can also provide feedback reports, including key information such as download speed, success rate, failure reasons, automatic source switching, etc. This information not only helps users understand the current system operation status, but also provides data support for subsequent optimization and improvement.

[0022] 3) Efficient error handling and recovery mechanism

[0023] The present invention proposes that the system has an efficient error handling and recovery mechanism built in, which can quickly respond and attempt to recover when encountering errors or abnormal situations. This mechanism can reduce the risk of download interruptions and data loss caused by system failures, and improve the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 npm multi-source intelligent fast-cut download device system architecture diagram;

[0025] Figure 2 Flowchart of the npm multi-source intelligent fast-cut download device.

[0026] Figure 3 Source assessment mechanism process;

[0027] Figure 4 To intelligently switch the logic flow. DETAILED DESCRIPTION

[0028] The technical solution of the present invention aims to optimize the user experience, intelligence level, performance and maintainability of the automatic switching system of the npm multi-source download device. The following is a detailed description of the technical solution:

[0029] (1) System architecture design, Figure 1 npm multi-source intelligent fast-cut download device system architecture diagram; Figure 2 Flowchart of npm multi-source intelligent fast-cut download device:

[0030] 1) Modular design:

[0031] The system is split into multiple independent modules, each of which is responsible for a specific function (such as source management, download task scheduling, performance monitoring, etc.).

[0032] Modules communicate through well-defined interfaces, reducing the coupling between modules and improving the scalability and maintainability of the system.

[0033] (2) Intelligent switching strategy

[0034] 1) The source assessment mechanism follows the following process:

[0035] Detect npm source; response time; download speed KB / s;

[0036] Detect the current source in use; response time; download speed;

[0037] Detect the current source network status; detect the source URL address; detect the number of successful npm source downloads;

[0038] Detect the number of failed npm source downloads; detect the npm source score;

[0039] By initializing the mainstream npm source repository by default, define the time threshold: if the time to download a package from one source exceeds a certain threshold (for example, 30 seconds), try to switch to another source; define the success rate threshold: if the download of a package from a source fails for multiple consecutive times (for example, 3 times), switch to another source; merge the user's privately defined repository source as the basis for automatic detection and switching, and record the timestamp of successful downloads and the number of failures.

[0040] 2) Intelligent switching logic:

[0041] Dynamically select the optimal npm source for downloading based on the user's network environment (such as response time, speed, etc.), failure rate, priority of download tasks, and source evaluation results.

[0042] Download timeout threshold (milliseconds);

[0043] The threshold of consecutive failures;

[0044] Merge user-defined source lists;

[0045] Detect npm source sorting;

[0046] Detect the npm source url address;

[0047] Check npm source score;

[0048] Detect the npm source download speed;

[0049] Detect the number of successful downloads of npm sources;

[0050] Detect the number of failed npm source downloads;

[0051] The timestamp of the last successful download;

[0052] Number of failures;

[0053] Supports custom switching strategies, allowing users to dynamically adjust the switching logic according to their needs.

[0054] If the best source fails too many times or for too long, consider switching;

[0055] Select a source with few failures and recent successes;

[0056] Initialize to the first source;

[0057] Update source configuration;

[0058] Update the number of failed downloads of the current source;

[0059] Supports custom switching strategies, allowing users to dynamically adjust the switching logic according to their needs.

[0060] If the best source fails too many times or for too long, consider switching;

[0061] Select a source with few failures and recent successes;

[0062] Initialize to the first source;

[0063] Update source configuration;

[0064] Update the number of failed downloads of the current source;

[0065] 3) Learning user preferences:

[0066] Record the user's download history and preference settings, and learn the user's download habits through data analysis. Optimize the switching strategy based on user preferences to provide a more personalized download experience.

[0067] Read the current storage log file;

[0068] Parsing user preference data from log files;

[0069] Average response time; Average speed; Success rate;

[0070] 4) Error handling and retry mechanism:

[0071] When an error occurs during the download process, it will automatically retry or switch to another source for download. It provides detailed error logs and reports to help users quickly locate and solve problems.

[0072] Try to download the file, support retry and source switching;

[0073] npm source list execution status subscript;

[0074] Number of retries;

[0075] Try downloading;

[0076] Wait for the retry interval;

[0077] Switch to the next source;

[0078] Reset the number of retries;

[0079] If all sources have been tried and failed, a final error is thrown;

[0080] Generate error reports;

[0081] Send the report to a server, display it to the user, or save it to a local file.

[0082] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A multi-source intelligent switching system based on npm package download, characterized in that: Set up an evaluation mechanism and switching logic to monitor the average response time of each npm source to requests, including the first response time and the response time of subsequent requests; Real-time detection of the speed of downloading packages from various sources, measured in KB / s, and the stability of the source is evaluated by recording the availability, success rate, and error rate indicators of the source and outputting them to the console; Intelligent switching strategy: 1) Source assessment mechanism: Monitor the response time, download speed, and stability of each npm source. By dynamically evaluating the performance of the source and the current network environment, the system can select the best download source to improve download speed and stability. 2) Intelligent switching logic: The system dynamically evaluates the source results, the priority of the download task, and the weight of each source based on the current network environment, and dynamically selects the optimal source for downloading. The system continuously monitors the performance of each source during the download process, and adjusts the switching strategy in real time based on the actual situation. Dynamically select the best npm source for download based on the user's bandwidth, network latency, download task priority, and source evaluation results; Supports custom switching strategies, allowing users to adjust the switching logic according to their needs; 3) Learning user preferences: Record users' download history and preference settings, and learn users' download habits through data analysis; optimize switching strategies based on user preferences to provide a more personalized download experience; 4) Error handling and retry mechanism: If the currently selected source has performance degradation or failure, the system will immediately switch to the alternative source to ensure that the download task is not affected; the system has a built-in efficient error handling and recovery mechanism that can quickly respond and try to recover or switch to a new source for downloading when encountering errors or abnormal situations; When an error occurs during downloading, automatically retry or switch to another source for downloading; Provides detailed error logs and reports to help users quickly locate and solve problems.

2. The multi-source intelligent switching system based on npm package download according to claim 1 is characterized in that: Through testing of network connectivity, network speed and other aspects, intelligent and automated source selection is achieved.

3. The multi-source intelligent switching system based on npm package download according to claim 1 is characterized in that: The system has a built-in efficient error handling and recovery mechanism that can respond quickly and attempt to resume downloads when encountering abnormal situations, reducing the risk of download interruptions and optimizing download speed and stability.

4. The multi-source intelligent switching system based on npm package download according to claim 1 is characterized in that: Set the npm source download order and rules, and view download progress, logs and other information.

5. The multi-source intelligent switching system based on npm package download according to claim 1 is characterized in that: Supports custom switching strategies, allowing users to flexibly configure according to their needs, improving the user experience.

6. The multi-source intelligent switching system based on npm package download according to claim 1 is characterized in that: In the intelligent switching strategy, 1) The source assessment mechanism follows the following process: Detect npm source; response time; download speed KB / s; Detect current use source; response time; Download speed; Detect the current source network status; detect the source URL address; detect the number of successful npm source downloads; Detect the number of failed npm source downloads; detect the npm source score; By initializing the mainstream npm source repository by default, define the time threshold: if the time to download a package from one source exceeds a certain threshold (for example, 30 seconds), try to switch to another source; define the success rate threshold: if the download of a package from a certain source fails for multiple consecutive times, switch to another source; merge the user's privately defined repository source as the basis for automatic detection and switching, and record the timestamp of successful downloads and the number of failures. 2) Intelligent switching logic: Dynamically select the best npm source for download based on the user's network environment, failure rate, download task priority, and source evaluation results; detect the download timeout threshold (milliseconds); The threshold of consecutive failures; Merge user-defined source lists; Check the npm source sorting; Detect the npm source url address; Check npm source score; Detect the npm source download speed; Detect the number of successful downloads of npm sources; Detect the number of failed npm source downloads; Check the timestamp of the last successful download; check the number of failures; 3) Support custom switching strategies, allowing users to dynamically adjust the switching logic according to their needs. If the best source fails too many times or for too long, consider switching; Select a source with few failures and recent successes; Initialize to the first source; Update source configuration; Update the number of failed downloads of the current source; Supports custom switching strategies, allowing users to dynamically adjust the switching logic according to their needs. If the best source fails too many times or for too long, consider switching; Select a source with few failures and recent successes; Initialize to the first source; Update source configuration; Update the current source download failure count. 3) Learning user preferences: Record the user's download history and preference settings, and learn the user's download habits through data analysis. Optimize the switching strategy based on user preferences to provide a more personalized download experience. Read the current storage log file; Parsing user preference data from log files; Average response time; Average speed; Success rate; 4) Error handling and retry mechanism: Automatically retry or switch to another source for downloading when an error occurs during the download process. Provides detailed error logs and reports to help users quickly locate and solve problems.

7. The multi-source intelligent switching system based on npm package download according to claim 1 is characterized in that: The error handling and retry mechanism is to automatically retry or switch to other sources for downloading when an error occurs during the download process; Provides detailed error logs and reports to help users quickly locate and solve problems: attempts to download files, supports retries and source switching; npm source list execution status subscripts; number of retries; Try downloading; wait for retry interval; switch to next source; Reset the number of retries; throw a final error if all sources have been tried and failed; generate an error report; send the report to a server, display it to the user, or save it to a local file.

Citation Information

Patent Citations

  • Method and system for automatically processing npm dependent packet installation and computer equipment

    CN112527335A

  • Maven automatic source switching control method and system

    CN117560363A

  • Browser adjusting method and mobile terminal

    US20120209969A1

  • Method and device for source selection in peer-assisted network coded streaming

    WO2024208886A1