Combine Text Files using a TXT File Merger

Suppose you have multiple Text files and looking to merge them into a single Text file, GroupDocs.Merger Cloud SDK for Node.js provides features to combine Text files programmatically. No matter how large your Text file is, this TXT file merger enables you to merge Text files efficiently. In addition, GroupDocs.Merger offers cloud SDKs and REST API for third-party integrations. However, this blog post teaches you to join Text files using GroupDocs.Merger Cloud SDK for Node.js in a Node.js-based project. By the end of this blog post, you should have learned how to combine Text files in Node.js.

We will follow the following points in this article:

TXT File Merger API Installation

The installation process of GroupDocs.Merger Cloud SDK for Node.js is just running a command away. It is lightweight and requires very less system resources. So, you may set up this TXT File Merger API by running the following command in Terminal/CMD:

npm install groupdocs-merger-cloud

Once the installation is completed, please visit this link to learn how to obtain API credentials(Client ID + Client Secret).

Combine Text Files Programmatically

Let’s combine Text files using the methods exposed by these cloud SDKs. For this purpose, we have uploaded two different Text files on the cloud dashboard.

Please visit this link to upload the files programmatically.

Follow the following steps to join Text files in Node.js:

  • Include the groupdocs-merger-cloud module in your app.
  • Initialize the instance of the DocumentApi with the API credentials.
  • Instantiate an object of the JoinItem class.
  • Create an object of the FileInfo class.
  • Set the file path of the source Text file.
  • Create an object of the JoinOptions class.
  • Call the JoinItems property to assign the source document array.
  • Set the output path for the generated merged document.
  • Initialize an instance of the JoinRequest class and pass it into the join method.

The following code sample demonstrates how to merge Text files using Node.js:

Once you run the server, a merged Text file is generated into the “Output” folder as shown in the image below:

merge text files
So, you can download the generated file manually or by invoking the DownloadFile method in case you want to download programmatically.

Merge Text Files Online

In addition, you can leverage the online version of GroupDocs.Merger Cloud SDK. It is quite easy to use, just drop/upload the Text files and press the “Merge now” button to join Text files instantly. You may explore further by navigating to the link given below.

merge text files online

Conclusion

This brings us to the end of this guide. We hope you have learned how to combine text files using GroupDocs.Merger Cloud SDK in a Node.js-based project. Moreover, this article will help you in building a TXT file merger for your business application. In addition, you may explore this API further by visiting documentation. In fact, you can check the GitHub repo since GroupDocs.Merger Cloud SDK for Node.js is open-source. Lastly, do not forget to interact with our API here directly.

Further, we recommend you follow our Getting Started guide.

Finally, groupdocs.cloud is writing new articles. So, please stay in touch for the latest updates.

Ask a question

You can let us know about your questions or queries on our forum.

Frequently Asked Questions – FAQs

What is the software for merging text files?

GroupDocs.Merger has exposed SDKs for multiple programming languages and REST APIs to merge Text files programmatically.

How do I combine multiple text files into one?

Please visit this link to know the answer in detail.

See Also