[{"data":1,"prerenderedAt":105},["ShallowReactive",2],{"/2025/09/03-generate-large-text-files":3},{"id":4,"title":5,"body":6,"date":96,"description":92,"extension":97,"meta":98,"navigation":99,"path":100,"robots":101,"seo":102,"stem":103,"__hash__":104},"posts/2025/09/03 generate-large-text-files.md","03 Generate Large Text Files",{"type":7,"value":8,"toc":91},"minimark",[9,18,21,25,41,44,52,61,67,77,80,88],[10,11,13],"post-title",{":date":12},"date",[14,15,17],"h1",{"id":16},"generate-large-text-files","Generate Large Text Files",[19,20],"br",{},[22,23,24],"p",{},"As part of my work, I need to ensure I can upload and download a reasonably large document. Just to ensure that I can validate that downloaded document is the same document after uploading. I decided to find a way to create a large text file with random string.",[22,26,27,28,32,33,36,37,40],{},"After quick search, the easiest and reliable way for me is to use Linux. On Windows, I simply use WSL and change directory to ",[29,30,31],"code",{},"/mnt/c/..."," which is the same directory as ",[29,34,35],{},"C:\\..."," in Windows, e.g. ",[29,38,39],{},"/mnt/c/Users/username/Downloads",". That way I know where the file is saved to and can access it on Windows side.",[22,42,43],{},"And to generate the text file, I modified the command that I found online since I want to specify the size of the file and ends up with:",[45,46,47],"code-block",{},[22,48,49],{},[29,50,51],{},"tr -dc \"A-Za-z0-9\" \u003C /dev/urandom | fold -w100 | head -c 100M > textfile.txt",[22,53,54,60],{},[29,55,59],{"className":56},[57,58],"bg-gray-200","p-2","tr -dc \"A-Za-z0-9\" \u003C /dev/urandom"," will generate random alphanumeric string.",[22,62,63,66],{},[29,64,65],{},"fold -w100"," will insert a new line every 100 characters. This helps to be able to open the file fast which works very well in Notepad++ compared to putting all the characters in a single line.",[68,69,70],"ul",{},[71,72,73,76],"li",{},[29,74,75],{},"head -c 100M > textfile.txt"," will take the first 100MB of randomly generated characters and save them in textfile.txt.",[22,78,79],{},"There you go. I managed to create text files with various sizes for my testing. Obviously, the larger the file, the longer it takes.",[81,82,83],"section-title",{},[84,85,87],"h2",{"id":86},"github-repository","GitHub Repository",[22,89,90],{},"(TBA)",{"title":92,"searchDepth":93,"depth":93,"links":94},"",2,[95],{"id":86,"depth":93,"text":87},"2025-09-03T00:00:00.000Z","md",{},true,"/2025/09/03-generate-large-text-files",null,{"title":5,"description":92},"2025/09/03 generate-large-text-files","oMmNey0YHw8GbdYwHANL9JIpQ0iLJv1ANvmut3ipOe4",1785167453301]