CN113505109A - File sharing method and device, computer equipment and storage medium - Google Patents

File sharing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113505109A
CN113505109A CN202110852887.7A CN202110852887A CN113505109A CN 113505109 A CN113505109 A CN 113505109A CN 202110852887 A CN202110852887 A CN 202110852887A CN 113505109 A CN113505109 A CN 113505109A
Authority
CN
China
Prior art keywords
file
application
target
soft link
shared file
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.)
Pending
Application number
CN202110852887.7A
Other languages
Chinese (zh)
Inventor
金士杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202110852887.7A priority Critical patent/CN113505109A/en
Publication of CN113505109A publication Critical patent/CN113505109A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a file sharing method, apparatus, computer device and storage medium, the method comprising: responding to a file downloading trigger event aiming at a target application, and acquiring file configuration information corresponding to an application file to be downloaded of the target application; determining a target shared file which is the same as the application file from at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment; acquiring a local file based on the target shared file; wherein the local file is used to replace the application file. The method for acquiring the local file can omit the downloading process of the application file, can improve the downloading speed of the target application, save the downloading flow, can effectively reduce the probability of downloading the repeated file by the equipment, avoids the storage space of the equipment from being occupied by repeated resources, and is beneficial to improving the running speed of the equipment.

Description

File sharing method and device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a file sharing method and apparatus, a computer device, and a storage medium.
Background
The installation package is a set of files capable of being automatically decompressed for an application, wherein the files include all files for application installation, and all corresponding files for the application can be released to a hard disk by downloading and running the installation package so as to complete the installation process of the application.
In the prior art, when downloading an installation package of an application, the complete installation package is generally downloaded to a device. In some cases, the device stores part of the application file in advance before downloading the new installation package, so downloading the complete installation package may cause the file to be duplicated, resulting in resource waste.
Disclosure of Invention
The embodiment of the disclosure at least provides a file sharing method, a file sharing device, computer equipment and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a file sharing method, which is applied to a terminal device, and the method includes:
responding to a file downloading trigger event aiming at a target application, and acquiring file configuration information corresponding to an application file to be downloaded of the target application;
determining a target shared file which is the same as the application file from at least one candidate shared file in the terminal equipment based on the file configuration information and the at least one candidate shared file;
acquiring a local file based on the target shared file;
wherein the local file is used to replace the application file.
In an optional implementation manner, when the target shared file is a file in an internal storage, the obtaining a local file based on the target shared file includes:
and acquiring a soft link file corresponding to the target shared file in the terminal equipment, and taking the soft link file as a local file.
In an optional implementation manner, the obtaining, in the terminal device, a soft link file corresponding to the target shared file, and taking the soft link file as a local file includes:
and when the soft link file corresponding to the target shared file is determined to be stored in the terminal equipment and the soft link file is in an effective state, taking the soft link file as a local file.
In an optional implementation manner, the obtaining, in the terminal device, a soft link file corresponding to the target shared file, and taking the soft link file as a local file includes:
when the terminal equipment is determined not to store the soft link file corresponding to the target shared file, generating the soft link file corresponding to the target shared file, and taking the generated soft link file as a local file;
or when it is determined that the terminal device stores the soft link file corresponding to the target shared file and the soft link file is in a failure state, generating the soft link file corresponding to the target shared file, and using the generated soft link file as a local file.
In an optional implementation manner, when the target shared file is a file in an external storage, the obtaining a local file based on the target shared file includes:
and acquiring a copy file of the target shared file in the terminal equipment, and taking the copy file as a local file.
In an alternative embodiment, the file configuration information includes uniqueness information of the application file, and the target shared file identical to the application file is determined in the at least one candidate shared file by:
determining uniqueness information of the application file from the file configuration information;
and determining a target shared file with the corresponding uniqueness information being the same as the uniqueness information of the application file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file.
In an optional embodiment, the method further comprises:
and determining that the target shared file which is the same as the application file does not exist in at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment, and downloading the application file from the server.
In an alternative embodiment, the file configuration information includes uniqueness information of the application file, and it is determined that the target shared file identical to the application file does not exist in the at least one candidate shared file by the following steps:
determining uniqueness information of the application file from the file configuration information;
and determining that the uniqueness information of the application file is not the same as the uniqueness information of each candidate shared file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file, and determining that the target shared file which is the same as the application file does not exist in the at least one candidate shared file.
In an optional embodiment, after the downloading the application file from the server, the method further comprises:
and when the application file is a file in the internal storage, acquiring a soft link file corresponding to the application file, and using the soft link file as a local file.
In an optional embodiment, the method further comprises:
responding to a file maintenance triggering event, and for each candidate shared file in the internal storage, when determining that the soft link file corresponding to the candidate shared file is in an abnormal state, repairing the soft link file in the abnormal state;
or, in response to a file maintenance triggering event, for each candidate shared file in the internal storage, deleting the candidate shared file when determining that the candidate shared file does not have the corresponding soft link file.
In an alternative embodiment, the at least one candidate shared file includes a file of at least one first native application associated with the target application, wherein the first native application is an application having the same file as the target application.
In a second aspect, an embodiment of the present disclosure provides a terminal device, where the terminal device includes:
the information acquisition module is used for responding to a file downloading trigger event aiming at a target application and acquiring file configuration information corresponding to an application file to be downloaded of the target application;
a target determining module, configured to determine, based on the file configuration information and at least one candidate shared file in the terminal device, a target shared file that is the same as the application file from the at least one candidate shared file;
the file acquisition module is used for acquiring a local file based on the target shared file;
wherein the local file is used to replace the application file.
In an optional implementation manner, when the target shared file is a file in an internal storage, the file obtaining module is specifically configured to, when obtaining a local file based on the target shared file,:
and acquiring a soft link file corresponding to the target shared file from the terminal equipment, and taking the soft link file as a local file.
In an optional implementation manner, the file obtaining module is configured to obtain a soft link file corresponding to the target shared file from the terminal device, and when the soft link file is used as a local file, specifically configured to:
and when the soft link file corresponding to the target shared file is determined to be stored in the terminal equipment and the soft link file is in an effective state, taking the soft link file as a local file.
In an optional implementation manner, the file obtaining module is configured to obtain a soft link file corresponding to the target shared file from the terminal device, and when the soft link file is used as a local file, specifically configured to:
when the terminal equipment is determined not to store the soft link file corresponding to the target shared file, generating the soft link file corresponding to the target shared file, and taking the generated soft link file as a local file;
or when it is determined that the terminal device stores the soft link file corresponding to the target shared file and the soft link file is in a failure state, generating the soft link file corresponding to the target shared file, and using the generated soft link file as a local file.
In an optional implementation manner, when the target shared file is a file in an external storage, the file obtaining module is specifically configured to, when obtaining a local file based on the target shared file,:
and acquiring a copy file of the target shared file in the terminal equipment, and taking the copy file as a local file.
In an alternative embodiment, the file configuration information includes uniqueness information of the application file, and the target determination module is configured to determine a target shared file identical to the application file from among the at least one candidate shared file by:
determining uniqueness information of the application file from the file configuration information;
and determining a target shared file with the corresponding uniqueness information being the same as the uniqueness information of the application file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file.
In an optional implementation manner, the terminal device further includes a file downloading module, where the file downloading module is configured to:
and determining that the target shared file which is the same as the application file does not exist in at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment, and downloading the application file from the server.
In an alternative embodiment, the file configuration information includes uniqueness information of the application file, and the file download module is configured to determine that the target shared file identical to the application file does not exist in the at least one candidate shared file by:
determining uniqueness information of the application file from the file configuration information;
and determining that the uniqueness information of the application file is not the same as the uniqueness information of each candidate shared file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file, and determining that the target shared file which is the same as the application file does not exist in the at least one candidate shared file.
In an optional implementation manner, the file obtaining module is further configured to:
and when the application file is a file in the internal storage, acquiring a soft link file corresponding to the application file, and using the soft link file as a local file.
In an optional implementation manner, the terminal device further includes a file maintenance module, where the file maintenance module is configured to:
responding to a file maintenance triggering event, and for each candidate shared file in the internal storage, when determining that the soft link file corresponding to the candidate shared file is in an abnormal state, repairing the soft link file in the abnormal state;
or, in response to a file maintenance triggering event, for each candidate shared file in the internal storage, deleting the candidate shared file when determining that the candidate shared file does not have the corresponding soft link file.
In an alternative embodiment, the at least one candidate shared file includes a file of at least one first native application associated with the target application, wherein the first native application is an application having the same file as the target application.
In a third aspect, embodiments of the present disclosure provide a computer device, including a processor, a memory, and a bus; the memory stores machine-readable instructions executable by the processor to communicate with the memory over the bus when the computer device is run, the machine-readable instructions being executable by the processor to perform the steps of the first aspect described above, or any one of the possible file sharing methods of the first aspect.
In a fourth aspect, the embodiments of the present disclosure provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the first aspect described above, or any one of the possible file sharing methods in the first aspect.
According to the file sharing method, the file sharing device, the computer device and the storage medium provided by the embodiment of the disclosure, before the application file of the application is downloaded, when the target shared file identical to the application file is determined in at least one candidate shared file of the terminal device, the local file used for replacing the application file is obtained through the target shared file, so that the downloading process of the application file can be omitted, the downloading speed of the target application can be improved, the downloading flow can be saved, the probability that the device downloads the repeated file can be effectively reduced, the storage space of the device is prevented from being occupied by repeated resources, and the running speed of the device can be improved.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
Fig. 1 is a flowchart of a file sharing method according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of another file sharing method provided by the embodiments of the present disclosure;
fig. 3 is a schematic diagram of a file sharing apparatus according to an embodiment of the disclosure;
fig. 4 is a second schematic diagram of a file sharing apparatus according to a second embodiment of the disclosure;
fig. 5 is a third schematic diagram of a file sharing device according to a third embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Research shows that the installation package is a set of files capable of being automatically decompressed for an application, wherein the files include all files for application installation, and downloading and running the installation package can release all corresponding files for the application to a hard disk so as to complete the installation process of the application.
In the prior art, when downloading an installation package of an application, the complete installation package is generally downloaded to a device. In some cases, the device stores part of the application file in advance before downloading the new installation package, so downloading the complete installation package may cause the file to be duplicated, resulting in resource waste.
Based on the above research, the present disclosure provides a file sharing method, before downloading an application file of an application, when a target shared file identical to the application file is determined in at least one candidate shared file of a terminal device, a local file used for replacing the application file is obtained through the target shared file, so that a downloading process of the application file can be omitted, a downloading speed of the target application can be increased, a downloading flow rate can be saved, a probability that the device downloads a duplicate file can be effectively reduced, occupation of a storage space of the device by duplicate resources is avoided, and an increase in an operation speed of the device is facilitated.
The above-mentioned drawbacks are the results of the inventor after practical and careful study, and therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to the above-mentioned problems should be the contribution of the inventor in the process of the present disclosure.
To facilitate understanding of the present embodiment, first, a file sharing method disclosed in the embodiments of the present disclosure is described in detail, where an execution subject of the file sharing method provided in the embodiments of the present disclosure is generally a computer device with certain computing capability, and the computer device includes, for example: a terminal device, which may be a User Equipment (UE), a mobile device, a User terminal device, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or a server or other processing device. In some possible implementations, the file sharing method may be implemented by a processor calling computer readable instructions stored in a memory.
The following describes a file sharing method provided by the embodiment of the present disclosure, taking an execution subject as a terminal device as an example. Referring to fig. 1 and fig. 2, fig. 1 is a flowchart of a file sharing method provided in an embodiment of the present disclosure, and fig. 2 is a flowchart of another file sharing method provided in an embodiment of the present disclosure, as shown in fig. 1, the method includes steps S110 to S130, where:
s110: and responding to a file downloading trigger event aiming at the target application, and acquiring file configuration information corresponding to an application file to be downloaded of the target application.
The target application may be an independently running application or an application (e.g., applet) that runs based on the host application. In particular, the target application may be, but is not limited to, a gaming application, a shopping application, a video application, a chat application, and the like. The user may search for a target application desired to be downloaded in an application program, such as an application store, a browser, or a host application. Of course, the application program such as the application store, the browser, or the host application may also actively recommend the target application, so as to guide the user to download the target application.
The file downloading trigger event includes receiving a file downloading operation of a user for the target application, in which case, the terminal device may send an acquisition request for file configuration information corresponding to the target application to the server when receiving the file downloading operation of the user for the target application, and the server sends the file configuration information corresponding to the application file of the target application to the terminal device according to the acquisition request.
For a target application running based on a host application, a file download trigger event may include a start operation of a user for the target application in the host application, in this case, in a process of running the host application, when receiving the start operation of the user for the target application in the host application, a terminal device may send an acquisition request for file configuration information corresponding to the target application to a server, and the server sends the file configuration information corresponding to an application file of the target application to the terminal device according to the acquisition request.
S120: and determining a target shared file which is the same as the application file from the at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment. After step S120, step S130 may be performed.
The file configuration information may include information capable of indicating characteristics of an application file of the target application, and the at least one candidate shared file may include a file of at least one first native application with which the target application is associated. Here, the first native application may be an application having at least one file in common with the target application, wherein the first native application is previously installed in the terminal device, and thus the terminal device stores the file of the first native application. For example, multiple gaming applications may run based on the same host application, which may have the same file that may be a common file for the multiple gaming applications. Taking the game application based on the Unity engine as an example, the executable files of the engines corresponding to different game applications may be the same, and thus the executable file of the engine may serve as a common file for a plurality of game applications.
The target application may be one of the plurality of game applications, and the first local application may be at least one other game application of the plurality of game applications except the target game application, the at least one other game application being pre-installed in the terminal device.
The terminal device may determine whether the application file of the target application is the same as one of the at least one candidate shared file based on the file configuration information corresponding to the application file. It is to be understood that when an application file is identical to a candidate shared file, the same candidate file as the application file may be defined as a target shared file.
In the embodiment of the present disclosure, the file configuration information includes uniqueness information of the application file, where the uniqueness information may be a Message Digest of the application file, for example, the uniqueness information may be an MD5(Message Digest Algorithm, fifth edition) value of the application file. The terminal equipment can determine the uniqueness information of the application file from the file configuration information; and determining a target shared file with the corresponding uniqueness information being the same as the uniqueness information of the application file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file. It is to be understood that when the uniqueness information of the application file and the uniqueness information of a candidate shared file are the same, the candidate shared file may be determined as a target shared file.
S130: and acquiring the local file based on the target shared file.
After the target shared file is determined, the local file acquired based on the target shared file is used for replacing the application file of the target application, so that the application file of the target application does not need to be downloaded in the server, the downloading speed of the target application can be improved, and the downloading flow can be saved.
In the embodiment of the present disclosure, the storage location types of the candidate shared files may be different, for example, at least one candidate shared file may include a file in an internal storage and may also include a file in an external storage. It should be noted here that the internal storage and the external storage of the terminal device are not physically distinct, but logically distinct. Specifically, the internal storage refers to a private directory of the terminal device, which can be understood as a relatively private directory used by a "developer", and part of files must be placed in the internal storage to be recognized and run by the system, and the internal storage is usually in a linux system file format, has strict authority management, and supports soft linking. The external storage is typically a storage directory for user data, which is typically convenient for the user and may be understood as a directory for "users". The file format of the file in the external storage is supported for reading by windows, and the external storage does not typically support a soft connection.
And the acquisition modes of the corresponding local files are different for target shared files with different storage location types. The following describes how to obtain the local files corresponding to the target shared file in the internal storage and the target shared file in the external storage, respectively.
When the target shared file is a file in the internal storage, a soft link file corresponding to the target shared file may be acquired in the terminal device, and the soft link file is used as a local file. It should be noted that the soft link is also called symbolic link, the soft link file contains the path name of the source file (i.e. the target shared file), and the soft link file is similar to the shortcut of the source file, and the source file can be accessed by accessing the soft link file.
For the target shared file in the internal storage, whether the terminal device stores the soft link file corresponding to the target shared file and whether the soft link file is valid or not can be detected, and the soft link file is acquired by adopting a corresponding mode according to the detection result.
In the embodiment of the present disclosure, the terminal device stores first mapping relationship information between the candidate shared file and the corresponding soft link file. Specifically, for candidate shared files belonging to the internal storage, after the candidate shared files are downloaded to the terminal device, the candidate shared files may be named according to the uniqueness information of the candidate shared files, a soft-link file of the candidate shared files may be created, and the first mapping relationship information between the candidate shared files and the corresponding soft-link files may be established based on the uniqueness information of the candidate shared files, so that the uniqueness information of the candidate shared files and the corresponding soft-link files are stored in the terminal device in a key-value manner. For a target shared file in the internal storage, first mapping relation information corresponding to the target shared file may be acquired, and whether a soft link file corresponding to the target shared file is stored in the terminal device and whether the soft link file is valid or not may be detected based on the first mapping relation information.
And when the terminal equipment is determined to store the soft link file corresponding to the target shared file and the soft link file is in an effective state, taking the soft link file as a local file.
And when the terminal equipment is determined to store the soft link file corresponding to the target shared file and the soft link file is in a failure state, generating the soft link file corresponding to the target shared file, and taking the generated soft link file as a local file.
And when the terminal equipment is determined not to store the soft link file corresponding to the target shared file, generating the soft link file corresponding to the target shared file, and taking the generated soft link file as a local file.
In the embodiment of the present disclosure, when the target shared file is a file in the external storage, a copy file of the target shared file may be acquired in the terminal device, and the copy file may be used as a local file.
Specifically, for candidate shared files belonging to the external storage, after the candidate shared files are downloaded to the terminal device, the candidate shared files may be named with the uniqueness information of the candidate shared files, and second mapping relationship information of the uniqueness information of the candidate shared files and the file paths of the candidate shared files may be established. After the target shared file is determined, the target shared file may be located from the terminal device based on the second mapping relationship information, and the target shared file may be copied to obtain a copied file, and the copied file may be used as a local file. The local file used for replacing the application file is obtained by copying the target shared file, so that the downloading process of the application file can be omitted, and the downloading flow is saved.
It should be noted that, as shown in fig. 2, after step S110, one of step S120 and step S140 may be executed.
S140: and determining that the target shared file which is the same as the application file does not exist in the at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment, and downloading the application file from the server.
As previously described, the file configuration information may include information capable of indicating characteristics of an application file of the target application. The description of the candidate shared file refers to the description in step S120, and is not repeated here. The terminal device may determine whether the application file of the target application is the same as one of the at least one candidate shared file based on the file configuration information corresponding to the application file. It is to be understood that when the application file is not the same as each of the candidate shared files, it may be determined that the target shared file that is the same as the application file does not exist in the at least one candidate shared file.
In the embodiment of the present disclosure, the file configuration information includes uniqueness information of the application file, and the terminal device may determine the uniqueness information of the application file from the file configuration information; and determining that the uniqueness information of the application file is not the same as the uniqueness information of each candidate shared file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file, and determining that the target shared file which is the same as the application file does not exist in the at least one candidate shared file. Specifically, when the uniqueness information of the application file is different from the uniqueness information of each candidate shared file, it is determined that the target shared file which is the same as the application file does not exist in at least one candidate shared file.
It should be understood that the application files may be divided into files in the internal storage and files in the external storage according to the storage location type. In this embodiment of the disclosure, after step S140, if the downloaded application file is a file in the internal storage, a soft link file corresponding to the application file may be obtained, and the soft link file is used as a local file. It is understood that the application file downloaded in step S140 may be used as a candidate shared file for other applications, and the soft link file corresponding to the application file may be used as a local file of the other applications at the terminal device. Therefore, if the downloaded application file is a file in the internal storage, after the soft link file corresponding to the application file is acquired, the first mapping relationship information between the application file and the corresponding soft link file can be established based on the uniqueness information of the application file, and the first mapping relationship information is stored in the terminal device; if the downloaded application file is a file in the external storage, the candidate shared file can be named according to the uniqueness information of the candidate shared file, second mapping relation information of the uniqueness information of the candidate shared file and a file path of the candidate shared file is established, and the first mapping relation information is stored in the terminal equipment.
It is understood that after step S130 or step S140 ends, step S110 may be re-executed for the next application file of the target application.
In the embodiment of the present disclosure, for each candidate shared file in the internal storage, the terminal device may maintain the candidate shared file and the soft link file corresponding to the candidate shared file in response to a file maintenance trigger event. The file downloading trigger event may include that the terminal device receives a file maintenance starting operation of a user, and when the terminal device receives the file maintenance starting operation of the user, the terminal device may maintain the candidate shared file and the soft link file corresponding to the candidate shared file. The file download triggering event may also include that the terminal device determines that the current time is preset maintenance time, for example, file maintenance may be performed every 24 hours, and the terminal device determines that the last maintenance time reaches 24 hours from the current time, and may maintain the candidate shared file and the soft link file corresponding to the candidate shared file.
Specifically, for each candidate shared file in the internal storage, the terminal device may respond to a file maintenance trigger event, and when determining that the soft link file corresponding to the candidate shared file is in an abnormal state, repair the soft link file in the abnormal state; or deleting the candidate shared file when the candidate shared file is determined not to have the corresponding soft link file.
As described above, the terminal device stores the first mapping relationship information of the candidate shared file and the corresponding soft link file. Optionally, the terminal device may traverse each piece of first mapping relationship information in response to a file maintenance triggering event, and determine, for each piece of first mapping relationship information, whether a candidate shared file corresponding to the first mapping relationship information has a soft link file; and deleting the candidate shared file when determining that the candidate shared file does not have the corresponding soft link file, determining whether the soft link file corresponding to the candidate shared file is in an abnormal state or not when determining that the candidate shared file has the corresponding soft link file, and repairing the soft link file in the abnormal state if determining that the soft link file corresponding to the candidate shared file is in the abnormal state.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, the embodiment of the present disclosure further provides a terminal device corresponding to the file sharing method, and since the principle of solving the problem of the terminal device in the embodiment of the present disclosure is similar to that of the file sharing method in the embodiment of the present disclosure, the implementation of the apparatus may refer to the implementation of the method, and repeated details are not described again.
Referring to fig. 3 and 4, fig. 3 is a schematic diagram of a terminal device provided in the disclosed embodiment, fig. 4 is a schematic diagram of a terminal device provided in the disclosed embodiment, and fig. 5 is a schematic diagram of a terminal device provided in the disclosed embodiment. As shown in fig. 3, the terminal device includes an information acquisition module 310, a target determination module 320, and a file acquisition module 330.
The information obtaining module 310 is configured to, in response to a file download trigger event for a target application, obtain file configuration information corresponding to an application file to be downloaded of the target application.
The target determination module 320 is configured to determine a target shared file identical to the application file from at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal device.
The file obtaining module 330 is configured to obtain a local file based on the target shared file.
Wherein the local file is used to replace the application file.
According to the terminal device, before the application file of the application is downloaded, when the target shared file which is the same as the application file is determined in at least one candidate shared file of the terminal device, the local file for replacing the application file is obtained through the target shared file, so that the downloading process of the application file can be omitted, the downloading speed of the target application can be improved, the downloading flow can be saved, the probability that the device downloads the repeated file can be effectively reduced, the storage space of the device is prevented from being occupied by repeated resources, and the running speed of the device is improved. In an optional implementation manner, when the target shared file is a file in the internal storage, the file obtaining module 330 is specifically configured to, when being configured to obtain the local file based on the target shared file,:
and acquiring a soft link file corresponding to the target shared file from the terminal equipment, and taking the soft link file as a local file.
In an optional implementation manner, the file obtaining module 330 is configured to obtain a soft link file corresponding to a target shared file from a terminal device, and when the soft link file is used as a local file, specifically configured to:
and when the terminal equipment is determined to store the soft link file corresponding to the target shared file and the soft link file is in an effective state, taking the soft link file as a local file.
In an optional implementation manner, the file obtaining module 330 is configured to obtain a soft link file corresponding to a target shared file from a terminal device, and when the soft link file is used as a local file, specifically configured to:
when the terminal device is determined not to store the soft link file corresponding to the target shared file, generating the soft link file corresponding to the target shared file, and taking the generated soft link file as a local file;
or when the terminal device is determined to store the soft link file corresponding to the target shared file and the soft link file is in a failure state, generating the soft link file corresponding to the target shared file, and taking the generated soft link file as a local file.
In an optional implementation manner, when the target shared file is a file in the external storage, the file obtaining module 330 is specifically configured to, when obtaining the local file based on the target shared file,:
and acquiring a copy file of the target shared file in the terminal equipment, and taking the copy file as a local file.
In an alternative embodiment, the file configuration information includes uniqueness information of the application file, and the target determination module 320 is configured to determine a target shared file identical to the application file from among the at least one candidate shared file by:
determining uniqueness information of the application file from the file configuration information;
and determining a target shared file with the corresponding uniqueness information being the same as the uniqueness information of the application file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file.
In an alternative embodiment, as shown in fig. 4, the terminal device further includes a file downloading module 340, where the file downloading module 340 is configured to:
and determining that the target shared file which is the same as the application file does not exist in the at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment, and downloading the application file from the server.
In an alternative embodiment, the file configuration information includes uniqueness information of the application file, and the file download module 340 is configured to determine that the target shared file identical to the application file does not exist in the at least one candidate shared file by:
determining uniqueness information of the application file from the file configuration information;
and determining that the uniqueness information of the application file is not the same as the uniqueness information of each candidate shared file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file, and determining that the target shared file which is the same as the application file does not exist in the at least one candidate shared file.
In an optional implementation manner, the file obtaining module 330 is further configured to:
and when the application file is a file in the internal storage, acquiring a soft link file corresponding to the application file, and taking the soft link file as a local file.
In an alternative embodiment, as shown in fig. 5, the terminal device further includes a file maintenance module 350, and the file maintenance module 350 is configured to:
responding to a file maintenance triggering event, and for each candidate shared file in the internal storage, when determining that the soft link file corresponding to the candidate shared file is in an abnormal state, repairing the soft link file in the abnormal state;
or, in response to a file maintenance triggering event, for each candidate shared file in the internal storage, deleting the candidate shared file when determining that the candidate shared file does not have the corresponding soft link file.
In an alternative embodiment, the at least one candidate shared file includes a file of at least one first native application associated with the target application, wherein the first native application is an application having the same file as the target application.
The description of the processing flow of each module in the terminal device and the interaction flow between each module may refer to the related description in the above method embodiments, and will not be described in detail here.
The embodiment of the present disclosure further provides a computer device, as shown in fig. 6, which is a schematic structural diagram of the computer device provided in the embodiment of the present disclosure, and the computer device includes a processor 610, a memory 620, and a bus 630. The memory 620 is used for storing instructions for execution and includes a memory 621 and an external storage 622. The memory 621 is also referred to as an internal memory, and is used to temporarily store operation data in the processor 610 and data exchanged with the external memory 622 such as a hard disk, and the processor 610 exchanges data with the external memory 622 via the memory 621. When the computer device is operating, communication between the processor 610 and the memory 620 via the bus 630 causes the processor 610 to execute the following instructions:
responding to a file downloading trigger event aiming at a target application, and acquiring file configuration information corresponding to an application file to be downloaded of the target application;
determining a target shared file which is the same as the application file from at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment;
acquiring a local file based on the target shared file;
wherein the local file is used to replace the application file.
The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the file sharing method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the file sharing method in the foregoing method embodiments, which may be referred to specifically in the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (14)

1. A file sharing method is applied to terminal equipment, and comprises the following steps:
responding to a file downloading trigger event aiming at a target application, and acquiring file configuration information corresponding to an application file to be downloaded of the target application;
determining a target shared file which is the same as the application file from at least one candidate shared file in the terminal equipment based on the file configuration information and the at least one candidate shared file;
acquiring a local file based on the target shared file;
wherein the local file is used to replace the application file.
2. The method according to claim 1, wherein when the target shared file is a file in an internal storage, the obtaining a local file based on the target shared file comprises:
and acquiring a soft link file corresponding to the target shared file in the terminal equipment, and taking the soft link file as a local file.
3. The method according to claim 2, wherein the obtaining, in the terminal device, a soft link file corresponding to the target shared file, and taking the soft link file as a local file includes:
and when the soft link file corresponding to the target shared file is determined to be stored in the terminal equipment and the soft link file is in an effective state, taking the soft link file as a local file.
4. The method according to claim 2, wherein the obtaining, in the terminal device, a soft link file corresponding to the target shared file, and taking the soft link file as a local file includes:
when the terminal equipment is determined not to store the soft link file corresponding to the target shared file, generating the soft link file corresponding to the target shared file, and taking the generated soft link file as a local file;
or when it is determined that the terminal device stores the soft link file corresponding to the target shared file and the soft link file is in a failure state, generating the soft link file corresponding to the target shared file, and using the generated soft link file as a local file.
5. The method according to claim 1, wherein when the target shared file is a file in an external storage, the obtaining a local file based on the target shared file comprises:
and acquiring a copy file of the target shared file in the terminal equipment, and taking the copy file as a local file.
6. The method according to claim 1, wherein the file configuration information includes uniqueness information of the application file, and the target shared file identical to the application file is determined in the at least one candidate shared file by:
determining uniqueness information of the application file from the file configuration information;
and determining a target shared file with the corresponding uniqueness information being the same as the uniqueness information of the application file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file.
7. The method of claim 1, further comprising:
and determining that the target shared file which is the same as the application file does not exist in at least one candidate shared file based on the file configuration information and the at least one candidate shared file in the terminal equipment, and downloading the application file from the server.
8. The method according to claim 7, wherein the file configuration information includes uniqueness information of the application file, and it is determined that the target shared file identical to the application file does not exist in the at least one candidate shared file by:
determining uniqueness information of the application file from the file configuration information;
and determining that the uniqueness information of the application file is not the same as the uniqueness information of each candidate shared file in the at least one candidate shared file based on the uniqueness information of the application file and the uniqueness information of each candidate shared file in the at least one candidate shared file, and determining that the target shared file which is the same as the application file does not exist in the at least one candidate shared file.
9. The method of claim 7, wherein after said downloading said application file from said server, said method further comprises:
and when the application file is a file in the internal storage, acquiring a soft link file corresponding to the application file, and using the soft link file as a local file.
10. The method of claim 1, further comprising:
responding to a file maintenance triggering event, and for each candidate shared file in the internal storage, when determining that the soft link file corresponding to the candidate shared file is in an abnormal state, repairing the soft link file in the abnormal state;
or, in response to a file maintenance triggering event, for each candidate shared file in the internal storage, deleting the candidate shared file when determining that the candidate shared file does not have the corresponding soft link file.
11. The method according to any one of claims 1 to 10, wherein the at least one candidate shared file comprises a file of at least one first native application associated with the target application, wherein the first native application is an application having the same file as the target application.
12. A terminal device, characterized in that the terminal device comprises:
the information acquisition module is used for responding to a file downloading trigger event aiming at a target application and acquiring file configuration information corresponding to an application file to be downloaded of the target application;
a target determining module, configured to determine, based on the file configuration information and at least one candidate shared file in the terminal device, a target shared file that is the same as the application file from the at least one candidate shared file;
the file acquisition module is used for acquiring a local file based on the target shared file;
wherein the local file is used to replace the application file.
13. A computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the computer device is run, the machine-readable instructions when executed by the processor performing the steps of the file sharing method according to any one of claims 1 to 11.
14. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the file sharing method according to any one of claims 1 to 11.
CN202110852887.7A 2021-07-27 2021-07-27 File sharing method and device, computer equipment and storage medium Pending CN113505109A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110852887.7A CN113505109A (en) 2021-07-27 2021-07-27 File sharing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110852887.7A CN113505109A (en) 2021-07-27 2021-07-27 File sharing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113505109A true CN113505109A (en) 2021-10-15

Family

ID=78014744

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110852887.7A Pending CN113505109A (en) 2021-07-27 2021-07-27 File sharing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113505109A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130144846A1 (en) * 2011-12-02 2013-06-06 International Business Machines Corporation Managing redundant immutable files using deduplication in storage clouds
CN107071060A (en) * 2017-05-27 2017-08-18 北京思特奇信息技术股份有限公司 A kind of SFTP files transmitting method and system
CN109669692A (en) * 2018-12-21 2019-04-23 深圳Tcl新技术有限公司 Source code sharing method, server, computer readable storage medium and system
CN112269668A (en) * 2020-10-26 2021-01-26 海信电子科技(深圳)有限公司 Application resource sharing and display equipment
CN112506584A (en) * 2020-12-21 2021-03-16 北京百度网讯科技有限公司 Resource file loading method, device, equipment, storage medium and product

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130144846A1 (en) * 2011-12-02 2013-06-06 International Business Machines Corporation Managing redundant immutable files using deduplication in storage clouds
CN107071060A (en) * 2017-05-27 2017-08-18 北京思特奇信息技术股份有限公司 A kind of SFTP files transmitting method and system
CN109669692A (en) * 2018-12-21 2019-04-23 深圳Tcl新技术有限公司 Source code sharing method, server, computer readable storage medium and system
CN112269668A (en) * 2020-10-26 2021-01-26 海信电子科技(深圳)有限公司 Application resource sharing and display equipment
CN112506584A (en) * 2020-12-21 2021-03-16 北京百度网讯科技有限公司 Resource file loading method, device, equipment, storage medium and product

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
祝胜林 等: "《计算机文化基础》", 30 June 2014, 哈尔滨:哈尔滨工业大学出版社, pages: 112 - 115 *
陈德源等: "《高技术引论》", 哈尔滨:哈尔滨工业大学出版社, pages: 269 - 270 *

Similar Documents

Publication Publication Date Title
CN110795399B (en) Method, device and system for generating machine ID for application
CN108268346B (en) Data backup method, device, equipment and storage medium
CN111240892B (en) Data backup method and device
CN106657433B (en) Naming method and device for physical network card in multi-network snap ring environment
CN110908734A (en) Application combination method and device based on plug-in, terminal equipment and storage medium
CN113785293B (en) File storage service initiation for anti-virus software locally installed on user device
CN111338689B (en) File calling method, device and equipment
CN112764997A (en) Log storage method and device, computer equipment and storage medium
CN112235433A (en) Domain name access method and device
CN113382024B (en) Rotation method of credential, computing device and storage medium
CN113535226A (en) Application downloading method, terminal, server, computer device and storage medium
CN113254470A (en) Data change method and device, computer equipment and storage medium
CN113114515A (en) Resource file configuration method and device
CN109710609B (en) Method and device for generating data table identification
CN113505109A (en) File sharing method and device, computer equipment and storage medium
CN113132241B (en) ACL template dynamic configuration method and device
CN112596825B (en) Cloud desktop starting method and device
CN111538520B (en) Updating method and device for super-converged cluster, terminal and storage medium
CN113157348A (en) Game starting method and device, computer equipment and storage medium
CN112631609A (en) Compiling method, device, terminal and storage medium
CN111752919A (en) Data writing method, data reading method and device
CN111953722A (en) Terminal address book synchronization method and device
CN110659309A (en) Memory database communication method, device, server and storage medium
CN116664129B (en) Block chain account book data iteration method, electronic equipment and readable storage medium
CN112579358B (en) Backup point detection method, device, equipment and storage medium

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
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information