Web-en

Split a text file with HTML5

It may happen to end up with a file (Fig 1) too big, that we want to split in smaller pieces. For example, a data file that we then want to upload in SAPicon, but that is too big in its present state.

File to split
Fig 1 : File to split

In order to send data in several picks, I propose you an HTML5icon tool (Fig 2)[1], with local execution (on your computer) only, which will split your text file locally and keep your data safe.

File splitting application, by Yoann Bierling
Fig 2 : File splitting application, by Yoann Bierling

Make sure you have your text file (Fig 1), specify number of header lines to split at the beginning of the file and to repeat on each part – or specify 0 if your file has no header lines – and the number of lines to get in each split.

Choose then the easiest way for you to provide the file, by selecting it on your computer, or by dragging and dropping it in the corresponding area.

File treatment may be long depending on your file size and your computer power.

You will then be able to get in the lower part of the results page (Fig 3) different parts of the file splitted. Right click on each part and select “Save link target as…”.

File splitting results, by Yoann Bierling
Fig 3 : File splitting results, by Yoann Bierling

Be careful, as the application[1] was built using HTML5icon, it may not work if you are using an old web browser (Fig 4) which do not manage current web standards. Do not hesitate to get Mozilla Firefox[2] or Google Chrome[3] for example.

API not supported error message
Fig 4 : API not supported error message

Technically, files are read locally[4], using File API[5], and then processed thanks to FileSystem[6]. A download link[7] is proposed. FIles are generated locally inbetween[8], download links are proposed using DOM modifications[9]. The interface is a simple CSS3icon styled[10] form.

Hyperlink

Links and credits

Images