CN111782730A - File uploading method and device and storage medium - Google Patents
File uploading method and device and storage medium Download PDFInfo
- Publication number
- CN111782730A CN111782730A CN202010655238.3A CN202010655238A CN111782730A CN 111782730 A CN111782730 A CN 111782730A CN 202010655238 A CN202010655238 A CN 202010655238A CN 111782730 A CN111782730 A CN 111782730A
- Authority
- CN
- China
- Prior art keywords
- file
- uploading
- cdn
- field
- directory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a file uploading method, a file uploading device and a storage medium, relates to the cloud technology, in particular to the technical field of computers, and aims to simplify the steps of uploading files to a CDN (content delivery network), realize quick uploading and improve uploading efficiency. The application is applied to a command line program for executing a file uploading function: acquiring an LBS field, a target file field and a CDN path directory field contained in a file uploading instruction according to the file uploading instruction input by a terminal device command line; according to the LBS field, acquiring pre-configured main file information from a Bin file configured corresponding to the LBS field; determining an entry main file according to the main file information; calling a file uploading script configured under the entry main file, and executing: and acquiring a target file according to the target file field, and uploading the target file to a specified directory of a CDN specified path. By inputting the file uploading instruction in the command line, the file is uploaded to the CDN, and the file uploading efficiency is improved.
Description
Technical Field
The application relates to the technical field of computers, and provides a file uploading method, a file uploading device and a storage medium.
Background
In the context of front-end engineering, files are becoming increasingly voluminous. If the file is uploaded to a common Web server, the loading performance is very low, so it is better to upload the file to a CDN (content delivery Network) and then perform static loading.
At present, when files are uploaded to a CDN, a directory and a path which are to be uploaded are clicked step by step on a CDN website mainly in a manual operation mode, and then the files which need to be uploaded are uploaded one by one, so that the process is complicated.
Disclosure of Invention
The embodiment of the application provides a file uploading method, a file uploading device and a storage medium, which are used for simplifying the step of uploading files to a CDN (content delivery network), realizing quick uploading and improving the uploading efficiency.
In a first aspect, the present application provides a method for uploading a file, which is applied in a command line program for executing a file uploading function, and the method includes:
according to a file uploading instruction input through a terminal device command line, obtaining an LBS (Location Based Services) field, a target file field and a CDN path directory field which are contained in the file uploading instruction;
according to the LBS field, acquiring pre-configured main file information from a Bin file configured corresponding to the LBS field;
determining an entry main file according to the main file information;
calling a file uploading script configured under the entry main file, and executing: and obtaining a target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of a CDN specified path.
In a second aspect, an embodiment of the present application provides an apparatus for uploading a file, where the apparatus includes: the device comprises a first obtaining module, a second obtaining module, a determining module and a calling module, wherein:
the first obtaining module is configured to: acquiring an LBS field, a target file field and a CDN path directory field contained in a file uploading instruction according to the file uploading instruction input by a terminal device command line;
the second obtaining module is configured to: according to the LBS field, acquiring pre-configured main file information from a Bin file configured corresponding to the LBS field;
the determination module is to: determining an entry main file according to the main file information;
the calling module is used for: calling a file uploading script configured under the entry main file, and executing: and obtaining a target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of a CDN specified path.
In a possible implementation manner, the file uploading device is a device corresponding to a command line program for executing a file uploading function, and the command line program is downloaded from a command line program pre-stored in a tnpm (Node Package Manager) server and installed locally on the terminal device;
the pre-stored command line program is obtained by uploading a tnpm registered account to a tnpm server by the development equipment in response to the registration operation and storing the command line program in the tnpm server in response to the operation of executing a tnpm publish command after determining that the tnpm server is successfully logged in.
In one possible implementation manner, the second obtaining module is further configured to: according to the LBS field, obtaining a map configuration file preset in a Bin file from the Bin file configured corresponding to the LBS field; starting a node environment of the terminal equipment according to the link relation of the environment variables stored in the map configuration file;
the calling module is specifically configured to: and calling the file uploading script under the node environment according to the node coding mode indicated by the head identification information of the main entry file.
In a possible implementation manner, the calling module is specifically configured to:
if the designated directory of the designated path is not stored in the CDN, the designated directory of the designated path is created in the CDN, and the target file is uploaded to the created designated directory of the designated path.
In one possible implementation, the calling module is further configured to:
and calling a preset packaging tool to package the target file before uploading the target file to the designated directory of the CDN.
In a possible implementation manner, the calling module is specifically configured to:
and calling a CDN helper interface, and uploading the target file to a specified directory of the CDN through the CDN helper interface.
In a third aspect, an embodiment of the present application provides a device for uploading a file, including: a memory and a processor, wherein the memory is configured to store computer instructions; and the processor is used for executing the computer instructions to realize the file uploading method.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where computer instructions are stored, and when executed by a processor, the computer instructions implement the method for uploading a file provided by the embodiment of the present application.
The beneficial effect of this application is as follows:
the application provides a method, a device and a storage medium for uploading files, and the method, the device and the storage medium are used for acquiring LBS fields, target file fields and CDN path directory fields contained in file uploading instructions according to the file uploading instructions input by a terminal device command line; according to the LBS field, acquiring pre-configured main file information from a Bin file configured corresponding to the LBS field; determining an entry main file according to the main file information; calling a file uploading script configured under the entry main file, and executing: acquiring a target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of a CDN specified path; and calling the script for executing the file uploading according to the file uploading instruction input in the command line, and executing the script to realize file uploading and one-key deployment, thereby simplifying the operation and improving the file uploading efficiency.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic view of an application scenario for uploading a file according to an embodiment of the present application;
fig. 2 is a schematic diagram of installing a command line program in a terminal device according to an embodiment of the present application;
fig. 3 is a flowchart of a method for uploading a file according to an embodiment of the present application;
fig. 4 is a flowchart of an overall method for uploading a file according to an embodiment of the present application;
fig. 5 is a structural diagram of a file uploading apparatus according to an embodiment of the present application;
fig. 6 is a structural diagram of a device for uploading a file according to an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solution and advantages of the present application more clearly and clearly understood, the technical solution in the embodiments of the present application will be described below in detail and completely with reference to the accompanying drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The following description is provided for illustrative purposes to facilitate understanding by those skilled in the art.
Command line:
also called a command prompt, a work prompt for prompting command input in the operating system. Command hints vary from one operating system environment to another. For example, in the Windows Operating System environment, the command line program is cmd.exe, which is a 32-bit command line program, and the Windows System is based on a command interpreter on Windows, which is similar to a DOS (Disk Operating System) Operating System.
LBS (Location Based Services ):
and acquiring the current position of the positioning equipment by utilizing various types of positioning technologies, and providing information resources and basic services for the positioning equipment through the mobile internet. LBS first determines its spatial location using location technology, and then the reader can obtain location related resources and information through the mobile internet. The LBS service integrates various information technologies such as mobile communication, internet, space positioning, position information, big data and the like, and a mobile internet service platform is utilized to update and interact data, so that a user can obtain corresponding services through space positioning.
CDN (Content Delivery Network):
the CDN is an intelligent virtual network constructed on the basis of the existing network, and by means of edge servers deployed in various places and functional modules of load balancing, content distribution, scheduling and the like of a central platform, a user can obtain required content nearby, network congestion is reduced, and the access response speed and hit rate of the user are improved. The key technology of the CDN is mainly content storage and distribution technology.
An entry master file:
when a program item or a system is accessed to a request, a first accessed file and all instruction functions are distributed from the file, then a corresponding module is found for processing, some initialization work is also carried out here, the file can call different modules of a framework according to different requests, and even some fields can be set, so that the later development and maintenance are facilitated.
tnpm(Node Package Manager):
The main stream suite management program under node.js is built in a Node system, can assist a developer to install, uninstall, delete and update a node.js suite through tnpm, and can issue a plug-in through tnpm.
A Bin file:
binary files, the purpose of which depends on the system or application. An abbreviation of file format binary. A file with the suffix ". bin" simply indicates that it is in the binary format. For example, the virtual drive files are usually given a ". bin" suffix, which does not mean that all bin files are virtual drive files. Generally machine code, the result of compilation in assembly language.
Environmental variables:
environment variables (environment variables) refer to fields in the operating system that are used to specify the operating system runtime environment, such as: temporary folder location and system folder location, etc.
An environment variable is an object in an operating system having a specific name that contains information to be used by one or more applications. For example, path environment variables in Windows and DOS operating systems, when a system is required to run a program without telling it the complete path that the program is in, the system will find the program under the current directory and will also find the path specified in the path. The user can better run the process by setting the environment variables.
The Commander framework: the command line tool open source packet is used for analyzing and converting parameter arrays, and performing regular matching on parameter formats and the like.
Src catalogue:
src refers to source, i.e., the meaning of source code, in software. In many languages engineering, an src folder is used to store source code to distinguish between other files (template files, Web files, etc.).
Scaffold:
is a meta-programming method for building database-based applications. The programmer writes a specification describing how to use the database; and a compiler of the scaffold generates corresponding codes according to the specification, and performs operations of adding, deleting, modifying and searching the database. This model is called "scaffolding" and powerful applications are built on the scaffolding with higher efficiency.
Cloud technology:
cloud technology refers to a hosting technology for unifying serial resources such as hardware, software, network and the like in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
Cloud technology (Cloud technology) is based on a general term of network technology, information technology, integration technology, management platform technology, application technology and the like applied in a Cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
The following briefly introduces the design concept of the embodiments of the present application.
In order to enable a user to obtain required content nearby, solve the problem of congestion of the Internet network, improve the response speed of the user for accessing a website, and upload the content required to be accessed by the user to the CDN.
The CDN widely uses various cache servers, distributes the cache servers to a region or a network where user access is relatively concentrated, and when a user accesses a website, directs the user access to a cache server that is closest to the working state using a global load technique, and the cache server directly responds to a user request.
Bottlenecks and links which possibly influence the data transmission speed and stability on the Internet are avoided as far as possible, so that the content transmission is faster and more stable. By placing node servers at various places of the network to form a layer of intelligent virtual network on the basis of the existing internet, the CDN can redirect a user's request to a service node closest to the user in real time according to network traffic, connection of each node, load conditions, distance to the user, response time, and other comprehensive information.
However, when the accessed content is uploaded to the CDN at present, only the traditional way, that is, the manual operation way, is used to click the directory and the path to be uploaded step by step on the CDN website, and then the files to be uploaded are uploaded one by one, which is complicated in process and cannot realize fast uploading of the files.
Therefore, the embodiment of the application provides a method and a device for uploading a file and a storage medium, and the method and the device achieve automatic uploading of the file to the CDN in a command line manner in the terminal device, achieve one-key deployment, are convenient to operate, and improve file uploading speed and efficiency.
According to the method, an uploading instruction is input in a terminal device command line, and an LBS field, a target file field and a CDN path directory field contained in the file uploading instruction are obtained according to the file uploading instruction input through the terminal device command line; acquiring pre-configured main file information from a Bin file configured corresponding to the LBS field according to the LBS field; determining an entry main file according to the main file information; calling a file uploading script configured under the entry main file, and executing: and obtaining a target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of a CDN specified path.
The method comprises the steps of inputting a file uploading instruction in a command line, determining a target file appointed to be uploaded in the file uploading instruction, uploading the target file to a CDN (content delivery network) path directory, determining a Bin file corresponding to an LBS (location based service) field in the file uploading instruction, determining main file information according to the Bin file, determining an entry main file according to the main file information, executing a file uploading script under the entry main file, uploading the target file to the appointed directory of the CDN appointed path, achieving one-key deployment without manual operation, namely achieving file uploading to the lower part, simplifying steps and improving the speed and efficiency of CDN file uploading.
After introducing the design idea of the embodiment of the present application, an application scenario set by the present application is briefly described below.
Fig. 1 is a schematic view of an application scenario for uploading a file provided in an embodiment of the present application. The application scenario includes a terminal device 10 and a server 11.
The terminal device 10, which is a hardware device for installing a command line program for executing a file uploading function, may be a terminal device such as a Personal Computer (PC), a tablet PC, a Personal Digital Assistant (PDA), a notebook, a mobile phone, or a Computer having a mobile terminal device, including various portable, pocket, handheld, Computer-embedded or vehicle-mounted mobile devices, which can provide a device for providing voice, data, or voice and data connectivity to a user, and exchange voice, data, or voice and data with a radio access network.
The server 11 may be any single background running device capable of providing internet services or a cluster or distributed system formed by a plurality of background running devices, and may also be a device providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, and the like.
In practical applications, the terminal device 10 and the server 11 are communicatively connected, and the network may be, but is not limited to, a local area network, a metropolitan area network, a wide area network, or the like.
In a possible application scenario, the application can be implemented based on a cloud technology, and particularly relates to a cloud storage technology in the cloud technology.
A distributed cloud storage system (hereinafter, referred to as a storage system) refers to a storage system that integrates a large number of storage devices (storage devices are also referred to as storage nodes) of different types in a network through application software or application interfaces to cooperatively work by using functions such as cluster application, grid technology, and a distributed storage file system, and provides a data storage function and a service access function to the outside.
In a possible implementation manner, the cloud server stores the uploaded target file in a cloud storage manner, and when receiving the request message, searches for the target file corresponding to the request message from the cloud storage.
In a possible application scenario, the servers 11 may be deployed in different regions for reducing communication delay, or different servers 11 may serve the regions corresponding to the terminal devices 10 respectively for load balancing. The plurality of servers 11 share data by a block chain, and the plurality of servers 11 correspond to a data sharing system including the plurality of servers 11. For example, the terminal device 10 is located at a site a and is in communication connection with the server 11, and the terminal device 10 is located at a site b and is in communication connection with another server 11.
Each server 11 in the data sharing system has a node identifier corresponding to the server 11, and each server 11 in the data sharing system may store node identifiers of other servers 11 in the data sharing system, so that the generated block is broadcast to other servers 11 in the data sharing system according to the node identifiers of other servers 11. Each server 11 may maintain a node identifier list as shown in the following table, and store the name of the server 11 and the node identifier in the node identifier list correspondingly. The node identifier may be an IP (Internet Protocol) address and any other information that can be used to identify the node, and table 1 only illustrates the IP address as an example.
TABLE 1
Server name | Node identification |
Node 1 | 119.115.151.174 |
Node 2 | 118.116.189.145 |
… | … |
Node N | 119.124.789.258 |
The method for uploading a file provided by the exemplary embodiments of the present application is described below with reference to the accompanying drawings in conjunction with the application scenarios described above, it should be noted that the application scenarios described above are only shown for the convenience of understanding the spirit and principles of the present application, and the embodiments of the present application are not limited in this respect.
In order to facilitate uploading of the local file of the terminal device to the CDN, a command line program for executing a file uploading function is installed in the terminal device, and the local file of the terminal device is uploaded to the CDN by the command line program for executing the file uploading function.
In the present application, the installation and use processes of a command line program for performing a file upload function are respectively described by the following embodiments.
The first embodiment is as follows: and installing a command line program for executing the file uploading function.
Fig. 2 is a schematic diagram illustrating an installation of a command line program for executing a file upload function according to an embodiment of the present application.
As is apparent from fig. 2, the command line program for executing the file upload function is stored in the tnpm server in advance, and when the user determines that the command line program for executing the file upload function needs to be used, the command line program for executing the file upload function is pulled from the tnpm server by tnpm installed in advance in the terminal device and installed locally in the terminal device.
In installing a command line program for performing a file upload function, a user can select whether to perform global installation or in-project installation. If the global installation is selected, pulling a command line program corresponding to 'tnpm install-g @ tencent/lbs-cli'; if the program is selected to be installed in the project, a command line program corresponding to the 'tnpm install @ tencent/lbs-cli-save' is pulled.
If the user does not select, the user defaults to perform global installation, and pulls the command line program corresponding to "tnpm install-g @ terminate/lbs-cli".
The command line program stored in advance in the tnpm server for executing the file uploading function is written by a developer and uploaded to the tnpm server, so that a user can pull the command line program in the tnpm server.
It should be noted that, in a general command line writing, a developer may rely on a framework commander as an auxiliary function, and through the framework, some parameters may be configured, and the configured parameters play a role of some description, so as to help the developer to implement development of a command line program for executing a file upload function.
As can be seen from fig. 2, a developer uploads a tnpm registered account on a tnpm package management tool of a development device, the tnpm registered account is uploaded to a tnpm server by the tnpm tool of the development device, and after the registered account passes verification, it is determined that tnpm is successfully logged in; and the tnmp in the development equipment responds to the operation of executing the tnmpublish command, and the code corresponding to the command line program written for executing the file uploading function is stored on the tnpm server by executing the tnmp publishing command, wherein the tnpm server is similar to a github warehouse, so that the tnpm server is a public database and can edit, move and delete the files stored in the tnpm server, and simultaneously create the files in the tnpm server.
Example two: a command line program for performing a file upload function is used.
According to the method and the system, the command line program for executing the file uploading function is deployed in the scaffold through the scaffold designed by the front-end personnel architecture, and a user can locally use the command line program for executing the file uploading function in the terminal equipment.
As shown in fig. 3, a flowchart of a method for uploading a file provided in an embodiment of the present application includes the following steps:
step S300, according to the file uploading instruction input by the terminal device command line, obtaining LBS field, target file field and CDN path directory field contained in the file uploading instruction.
In the present application, if a file is to be uploaded to the CDN by a command line program for executing a file upload function, a file upload instruction needs to be input in a command line of the terminal device, where the file upload instruction includes an LBS field, a target file field, and a CDN path directory field.
For example, the format of the file upload instruction input in the command line of the terminal device is as follows: lbs cdn./a.js-t/test/2020/, wherein a.js represents the target file field and/test/2020 represents the path directory field, and the meaning of the file upload command is as follows: upload a.js to cdn/test/2020/in.
Step S301, according to LBS field, obtaining pre-configured main file information from Bin file configured corresponding to LBS field.
In the command line program for executing the file uploading function, the LBS and the Bin file are bound in advance, so that after the LBS field in the file uploading instruction is determined, the Bin file matched with the LBS field is obtained according to the preset binding relationship between the LBS and the Bin file.
As a developer uses the frame commander as an auxiliary function, when writing a command line program for executing the file uploading function, a Bin file is established and parameter configuration is carried out on the Bin file, so that the Bin file plays a role in explanation in the using process.
In the application, a map configuration file is mainly preset in a Bin file, and a link relation of an environment variable is stored in the map configuration file, so that the environment variable in the environment can be linked through the Bin file, and a node environment in a local environment is started.
Meanwhile, main file information is configured in the Bin file, namely the main file is configured as follows: js of the entry master file index.js corresponding to the file uploading function can be searched.
Step S302, determining an entry main file according to the main file information.
Js header of the entry master file is preset with identification information "sql: #! And/usr/bin/env node ", wherein the identification information is used for specifying the execution script by the node code, so that the entry master file is executed by the node code under the node environment.
Js, the identification information for indicating the encoding method set in the entry master file index may be: "! /usr/bin/node ", but if a node is installed under a non-default path, it will not be found, so a" #!is preferred! The/usr/bin/env node' to find the node installation directory.
Step S303, calling a file uploading script configured under the entry main file, and executing: and obtaining a target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of a CDN specified path.
In the application, under a node environment, a node coding mode is adopted to call the file uploading script, and the file uploading script is executed in the node coding mode, so that the target file indicated in the file uploading instruction is uploaded to the specified directory of the CDN specified path indicated in the file uploading instruction.
The file uploading script is code logic written under the src directory and used for achieving a file uploading function, and the entry file is index.
In the uploading process, in order to accelerate the uploading speed, the target file can be packed and compressed. In the application, a packing tool preset in a command line program is mainly adopted to pack and compress the target file, and the packing tool can be a node-zip tool.
Therefore, in the embodiment of the application, when the file uploading script is executed, a preset packaging tool is called to package the target file, and the packaged target file is uploaded to the CDN.
In the application, if the file is to be uploaded to the CDN, an interface of the CDN needs to be found, so that the CDN helper interface is called, and the target file is uploaded to the specified directory of the specified path of the CDN through the CDN helper interface.
When the target file is uploaded to the designated directory of the designated path of the CDN, if the designated path and the designated directory are not stored in the CDN, the designated path is created in the CDN, the designated directory is created under the designated path, and then the target file is uploaded to the created designated directory of the designated path so as to ensure the normal uploading of the target file; or
If the designated directory is not stored in the CDN, the designated path in the file uploading instruction is searched in the CDN, the designated directory in the file uploading instruction is created under the designated path, and then the file is uploaded to the created designated directory of the designated path so as to ensure the normal uploading of the target file.
As shown in fig. 4, an overall method flowchart for uploading a file provided in an embodiment of the present application includes the following steps:
step S400, acquiring a file uploading instruction input in a terminal device command line.
Step S401, according to the file uploading instruction input by the terminal device command line, obtaining LBS field, target file field and CDN path directory field contained in the file uploading instruction.
And step S402, determining a Bin file with preselected configuration corresponding to the LBS field according to the LBS field.
Step S403, obtaining a map configuration file preset in the Bin file, and starting the node environment of the terminal device according to the link relation of the environment variables stored in the map configuration file.
Step S404, obtaining the preset main file information in the Bin file.
Step S405, determining an entry main file corresponding to the main file information in a node environment.
Step S406, according to the node coding mode indicated by the head identification information of the main file of the entry, in the node environment, calling a file uploading script under the main file of the entry.
Step S407, executing the file uploading script, calling a preset packaging tool, and packaging the target file corresponding to the target file field.
Step S408, calling a CDN helper interface, and uploading the packed target file to a specified directory of a specified path of the CDN through the CDN helper interface.
Specifically, the file uploading can be realized through the following programs:
based on the same inventive concept, an embodiment of the present application further provides an apparatus 500 for uploading a file, as shown in fig. 5, the apparatus 500 includes: a first obtaining module 501, a second obtaining module 502, a determining module 503 and a calling module 505, wherein:
the first obtaining module 501 is configured to: acquiring an LBS field, a target file field and a CDN path directory field contained in a file uploading instruction according to the file uploading instruction input by a terminal device command line;
the second obtaining module 502 is configured to: according to the LBS field, acquiring pre-configured main file information from a Bin file configured corresponding to the LBS field;
the determination module 503 is configured to: determining an entry main file according to the main file information;
the calling module 505 is configured to: calling a file uploading script configured under the entry main file, and executing: and obtaining a target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of a CDN specified path.
In a possible implementation manner, the file uploading device is a device corresponding to a command line program for executing a file uploading function, and the command line program is downloaded from a command line program pre-stored in a tnpm (Node Package Manager) server and installed locally on the terminal device;
the pre-stored command line program is obtained by uploading a tnpm registered account to a tnpm server by the development equipment in response to the registration operation and storing the command line program in the tnpm server in response to the operation of executing a tnpm publish command after determining that the tnpm server is successfully logged in.
In a possible implementation manner, the second obtaining module 502 is further configured to: according to the LBS field, obtaining a map configuration file preset in a Bin file from the Bin file configured corresponding to the LBS field;
starting a node environment of the terminal equipment according to the link relation of the environment variables stored in the map configuration file;
the calling module 505 is specifically configured to:
and calling the file uploading script under the node environment according to the node coding mode indicated by the head identification information of the main entry file.
In one possible implementation, the calling module 505 is specifically configured to:
if the designated directory of the designated path is not stored in the CDN, the designated directory of the designated path is created in the CDN, and the target file is uploaded to the created designated directory of the designated path.
In one possible implementation, the calling module 505 is further configured to:
and calling a preset packaging tool to package the target file before uploading the target file to the designated directory of the CDN.
In one possible implementation, the calling module 505 is specifically configured to:
and calling a CDN helper interface, and uploading the target file to a specified directory of the CDN through the CDN helper interface.
In one possible implementation, the file upload instruction is determined by concatenating the fields entered in the command line through the Commander framework.
For convenience of description, the above parts are separately described as units (or modules) according to functional division. Of course, the functionality of the various elements (or modules) may be implemented in the same one or more pieces of software or hardware in practicing the present application.
Having described the method and apparatus for uploading a document according to an exemplary embodiment of the present application, a document uploading apparatus according to another exemplary embodiment of the present application will be described.
As will be appreciated by one skilled in the art, aspects of the present application may be embodied as a system, method or program product. Accordingly, various aspects of the present application may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In one possible implementation manner, the device for uploading the file provided by the embodiment of the present application may include at least a processor and a memory. The memory has stored therein program code which, when executed by the processor, causes the processor to perform any of the steps of the file upload methods of the various exemplary embodiments of this application.
In some possible implementations, the present application further provides a computer-readable storage medium including program code, when the program product is executed on an electronic device, the program code is configured to cause the electronic device to perform the steps of the method for uploading a file in any one of the above embodiments.
An apparatus 600 for file upload according to this embodiment of the present application is described below with reference to fig. 6. The file uploading apparatus 600 of fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the file upload apparatus 600 is represented in the form of a general file upload apparatus. The components of the device 600 for file upload may include, but are not limited to: the at least one processor 601, the at least one memory unit 602, and the bus 603 that connects the various system components (including the memory unit 602 and the processor 601).
Bus 603 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.
The storage unit 602 may include readable media in the form of volatile memory, such as Random Access Memory (RAM)6021 and/or cache memory unit 6022, and may further include Read Only Memory (ROM) 6023.
The memory unit 602 may also include a program/utility 6025 having a set (at least one) of program modules 6024, such program modules 6024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The file uploading device 600 may also communicate with one or more external devices 604 (e.g., keyboard, pointing device, etc.), with one or more devices that enable a user to interact with the file uploading device 600, and/or with any device (e.g., router, modem, etc.) that enables the file uploading device 600 to communicate with one or more other file uploading devices. Such communication may occur via input/output (I/O) interfaces 605. Also, the file uploading device 600 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 606. As shown, a network adapter 606 communicates with the other modules of the device 600 for file upload over the bus 603. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the file upload device 600, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
In some possible implementations, the present application embodiments also provide a computer program product or a computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the steps of any one of the file uploading methods in the embodiments.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The present application is described above with reference to block diagrams and/or flowchart illustrations of methods, apparatus (systems) and/or computer program products according to embodiments of the application. It will be understood that one block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, and/or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer and/or other programmable data processing apparatus, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks.
Accordingly, the subject application may also be embodied in hardware and/or in software (including firmware, resident software, micro-code, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in connection with an instruction execution system. In the context of this application, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (10)
1. A method for uploading a file, the method being applied to a command line program for performing a file uploading function, the method comprising:
according to a file uploading instruction input through a terminal device command line, obtaining a location-based service LBS field, a target file field and a content delivery network CDN path directory field which are contained in the file uploading instruction;
according to the LBS field, obtaining pre-configured main file information from a binary file Bin file configured corresponding to the LBS field;
determining an entry main file according to the main file information;
calling a file uploading script configured under the entry main file, and executing: and acquiring the target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of the CDN specified path.
2. The method according to claim 1, wherein the command line program is downloaded from a command line program pre-stored in a package management tool tnpm server and installed locally to the terminal device;
the pre-stored command line program is obtained by uploading a tnpm registered account to the tnpm server by the development equipment in response to the registration operation and storing the command line program in the tnpm server in response to the operation of executing a tnpm publish command after determining that the tnpm server is successfully logged in.
3. The method of claim 1, wherein prior to invoking the file upload script configured under the entry master file, further comprising:
obtaining a map configuration file preset in the Bin file;
starting a node environment of the terminal equipment according to the link relation of the environment variables stored in the map configuration file;
the calling of the file upload script configured under the entry master file specifically includes:
and calling the file uploading script under the node environment according to the node coding mode indicated by the head identification information of the entry main file.
4. The method of claim 1, wherein uploading the target file under a specified directory of the CDN-specified path comprises:
if the designated directory of the designated path is not stored in the CDN, the designated directory of the designated path is created in the CDN, and the target file is uploaded to the created designated directory of the designated path.
5. The method of claim 1, wherein prior to uploading the target file under a specified directory of the CDN, further comprising:
and calling a preset packaging tool to package the target file.
6. The method according to any of claims 1 to 4, wherein uploading the target file to a designated directory of a designated path of the CDN comprises:
and calling a CDN helper interface, and uploading the target file to a specified directory of a specified path of the CDN through the CDN helper interface.
7. An apparatus for uploading a document, the apparatus comprising: the device comprises a first obtaining module, a second obtaining module, a determining module and a calling module, wherein:
the first obtaining module is configured to: according to a file uploading instruction input through a terminal device command line, obtaining an LBS field, a target file field and a CDN path directory field contained in the file uploading instruction;
the second obtaining module is to: according to the LBS field, acquiring pre-configured main file information from a Bin file configured corresponding to the LBS field;
the determination module is to: determining an entry main file according to the main file information;
the calling module is used for: calling a file uploading script configured under the entry main file, and executing: and acquiring the target file according to the target file field, determining a CDN path directory when the target file is uploaded according to the CDN path directory field, and uploading the target file to a specified directory of the CDN specified path.
8. The apparatus of claim 7, wherein the second obtaining module is further configured to: according to the LBS field, obtaining a map configuration file preset in a Bin file from the Bin file configured corresponding to the LBS field; starting a node environment of the terminal equipment according to the link relation of the environment variables stored in the map configuration file;
the calling module is specifically configured to: and calling the file uploading script under the node environment according to the node coding mode indicated by the head identification information of the entry main file.
9. An apparatus for uploading a file, the apparatus comprising: a memory and a processor, wherein the memory is configured to store computer instructions; a processor for executing computer instructions to implement the method of file upload according to any of claims 1-6.
10. A computer-readable storage medium storing computer instructions which, when executed by a processor, implement the method of uploading a file according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010655238.3A CN111782730B (en) | 2020-07-09 | 2020-07-09 | File uploading method and device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010655238.3A CN111782730B (en) | 2020-07-09 | 2020-07-09 | File uploading method and device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111782730A true CN111782730A (en) | 2020-10-16 |
CN111782730B CN111782730B (en) | 2021-07-06 |
Family
ID=72758468
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010655238.3A Active CN111782730B (en) | 2020-07-09 | 2020-07-09 | File uploading method and device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111782730B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112256646A (en) * | 2020-10-22 | 2021-01-22 | 北京金山云网络技术有限公司 | Method and device for operating subdirectory of file system, electronic equipment and storage medium |
CN112631690A (en) * | 2021-01-06 | 2021-04-09 | 中煤航测遥感集团有限公司 | File in applet and data processing method and device |
CN113114515A (en) * | 2021-05-12 | 2021-07-13 | 北京字节跳动网络技术有限公司 | Resource file configuration method and device |
Citations (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020139727A1 (en) * | 2000-08-23 | 2002-10-03 | Lockheed Martin Corporation | Mail bin sort sequence binary file generator |
CN101005369A (en) * | 2006-01-19 | 2007-07-25 | 深圳市瑞福特信息技术有限公司 | Distritive content sending net and distributive content sending and up transfering method |
US20070271344A1 (en) * | 2006-05-22 | 2007-11-22 | Kannan Danasekaran | Electronic mail message document attachment |
CN101145929A (en) * | 2007-08-09 | 2008-03-19 | 复旦大学 | A P2P stream media VoD system for IPV6 environment |
CN101206564A (en) * | 2006-12-20 | 2008-06-25 | 鸿富锦精密工业(深圳)有限公司 | Document version pipe control interface arrangement and method |
CN101594537A (en) * | 2009-06-04 | 2009-12-02 | 京北方科技股份有限公司 | Massive image data compression method |
CN101635635A (en) * | 2009-08-25 | 2010-01-27 | 北京原力创新科技有限公司 | Cloud mode streaming media service platform |
CN101729591A (en) * | 2008-10-29 | 2010-06-09 | ***通信集团公司 | User guide device, system and method |
CN101997896A (en) * | 2009-08-19 | 2011-03-30 | 中兴通讯股份有限公司 | Method and system for issuing document |
CN102195978A (en) * | 2011-04-26 | 2011-09-21 | 深圳市共济科技有限公司 | Software distribution deployment method and system |
CN102546805A (en) * | 2012-01-16 | 2012-07-04 | 合众思壮北斗导航有限公司 | Data transmission method and system |
CN102957744A (en) * | 2012-10-26 | 2013-03-06 | 北京百度网讯科技有限公司 | Method, system and device for location distributing of mobile terminal |
US20130231761A1 (en) * | 2012-03-02 | 2013-09-05 | Nokia Corporation | Method and apparatus for generating an audio summary of a location |
CN103501469A (en) * | 2013-09-25 | 2014-01-08 | 深圳先进技术研究院 | Method for adding geographic position information to tail part of video file |
US20170171294A1 (en) * | 2015-12-15 | 2017-06-15 | Yahoo! Inc. | Computerized System And Method For Determining And Communicating Media Content To A User Based On A Physical Location Of The User |
CN108418717A (en) * | 2018-03-02 | 2018-08-17 | 平安科技(深圳)有限公司 | Android application is packaged method for uploading, device, computer equipment and storage medium |
CN108469957A (en) * | 2018-03-08 | 2018-08-31 | 平安科技(深圳)有限公司 | Using packing method for uploading, device, computer equipment and storage medium |
CN108551481A (en) * | 2018-04-16 | 2018-09-18 | 武汉斗鱼网络科技有限公司 | A kind of file uploading method, device, server and storage medium |
CN110888848A (en) * | 2018-09-07 | 2020-03-17 | 珠海横琴盛达兆业科技投资有限公司 | Cross-server file uploading method |
CN110968357A (en) * | 2018-09-30 | 2020-04-07 | 北京国双科技有限公司 | Method and device for packaging maven item, storage medium and processor |
-
2020
- 2020-07-09 CN CN202010655238.3A patent/CN111782730B/en active Active
Patent Citations (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020139727A1 (en) * | 2000-08-23 | 2002-10-03 | Lockheed Martin Corporation | Mail bin sort sequence binary file generator |
CN101005369A (en) * | 2006-01-19 | 2007-07-25 | 深圳市瑞福特信息技术有限公司 | Distritive content sending net and distributive content sending and up transfering method |
US20070271344A1 (en) * | 2006-05-22 | 2007-11-22 | Kannan Danasekaran | Electronic mail message document attachment |
CN101206564A (en) * | 2006-12-20 | 2008-06-25 | 鸿富锦精密工业(深圳)有限公司 | Document version pipe control interface arrangement and method |
CN101145929A (en) * | 2007-08-09 | 2008-03-19 | 复旦大学 | A P2P stream media VoD system for IPV6 environment |
CN101729591A (en) * | 2008-10-29 | 2010-06-09 | ***通信集团公司 | User guide device, system and method |
CN101594537A (en) * | 2009-06-04 | 2009-12-02 | 京北方科技股份有限公司 | Massive image data compression method |
CN101997896A (en) * | 2009-08-19 | 2011-03-30 | 中兴通讯股份有限公司 | Method and system for issuing document |
CN101635635A (en) * | 2009-08-25 | 2010-01-27 | 北京原力创新科技有限公司 | Cloud mode streaming media service platform |
CN102195978A (en) * | 2011-04-26 | 2011-09-21 | 深圳市共济科技有限公司 | Software distribution deployment method and system |
CN102546805A (en) * | 2012-01-16 | 2012-07-04 | 合众思壮北斗导航有限公司 | Data transmission method and system |
US20130231761A1 (en) * | 2012-03-02 | 2013-09-05 | Nokia Corporation | Method and apparatus for generating an audio summary of a location |
CN102957744A (en) * | 2012-10-26 | 2013-03-06 | 北京百度网讯科技有限公司 | Method, system and device for location distributing of mobile terminal |
CN103501469A (en) * | 2013-09-25 | 2014-01-08 | 深圳先进技术研究院 | Method for adding geographic position information to tail part of video file |
US20170171294A1 (en) * | 2015-12-15 | 2017-06-15 | Yahoo! Inc. | Computerized System And Method For Determining And Communicating Media Content To A User Based On A Physical Location Of The User |
CN108418717A (en) * | 2018-03-02 | 2018-08-17 | 平安科技(深圳)有限公司 | Android application is packaged method for uploading, device, computer equipment and storage medium |
CN108469957A (en) * | 2018-03-08 | 2018-08-31 | 平安科技(深圳)有限公司 | Using packing method for uploading, device, computer equipment and storage medium |
CN108551481A (en) * | 2018-04-16 | 2018-09-18 | 武汉斗鱼网络科技有限公司 | A kind of file uploading method, device, server and storage medium |
CN110888848A (en) * | 2018-09-07 | 2020-03-17 | 珠海横琴盛达兆业科技投资有限公司 | Cross-server file uploading method |
CN110968357A (en) * | 2018-09-30 | 2020-04-07 | 北京国双科技有限公司 | Method and device for packaging maven item, storage medium and processor |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112256646A (en) * | 2020-10-22 | 2021-01-22 | 北京金山云网络技术有限公司 | Method and device for operating subdirectory of file system, electronic equipment and storage medium |
CN112256646B (en) * | 2020-10-22 | 2024-03-08 | 北京金山云网络技术有限公司 | Method and device for operating file system subdirectory, electronic equipment and storage medium |
CN112631690A (en) * | 2021-01-06 | 2021-04-09 | 中煤航测遥感集团有限公司 | File in applet and data processing method and device |
CN113114515A (en) * | 2021-05-12 | 2021-07-13 | 北京字节跳动网络技术有限公司 | Resource file configuration method and device |
CN113114515B (en) * | 2021-05-12 | 2022-09-13 | 北京字节跳动网络技术有限公司 | Resource file configuration method and device |
Also Published As
Publication number | Publication date |
---|---|
CN111782730B (en) | 2021-07-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111782730B (en) | File uploading method and device and storage medium | |
US10613788B2 (en) | Data migration between cloud storage systems | |
US10574724B2 (en) | Automatic discovery of management nodes and generation of CLI using HA module | |
US20130232470A1 (en) | Launching an application stack on a cloud platform environment | |
CN110673923A (en) | XWIKI system configuration method, system and computer equipment | |
CN112130871B (en) | Method and device for remotely deploying middleware, computer equipment and storage medium | |
US20210248114A1 (en) | System and method for customized graphql data-handling scripts | |
CN112905933A (en) | Page jump method and device, electronic equipment and storage medium | |
CN112199567A (en) | Distributed data acquisition method, system, server and storage medium | |
CN112181542A (en) | Function calling method and device, electronic equipment and storage medium | |
KR20230079348A (en) | Cloud code development system, method, device, device and storage medium | |
CN115329170A (en) | Webpage crawling method, device, equipment and storage medium | |
CN117112122A (en) | Cluster deployment method and device | |
CN112860251A (en) | Method and system for constructing website front end | |
CN114489622A (en) | Js application, electronic device, and storage medium | |
US11200052B1 (en) | Documentation enforcement during compilation | |
CN111240686B (en) | Cloud compiling method and system, terminal device, cloud server and storage medium | |
CN111538530A (en) | Page jump method and system, storage medium and electronic equipment | |
CN115314257B (en) | File system authentication method and device, electronic equipment and computer storage medium | |
CN112988738A (en) | Data slicing method and device for block chain | |
CN113542323A (en) | Service processing method, device, equipment and computer readable storage medium | |
CN104965909A (en) | Dynamic web content request handling method | |
CN115563183B (en) | Query method, query device and program product | |
US20230247111A1 (en) | Runtime module conversion | |
CN113890789B (en) | UDP tunnel traffic shunting method and traffic forwarding method suitable for data center |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |