I want to determine how large a file would be based on some text input but without having to save it to file.
From tests it appears a file with 4 characters in it will be 5 bytes.
Does this hold true in general, charcount + 1?
It’s a bunch of javascript that I am looking to save.
Many thanks for any advice.
Well it all breaks down when somebody puts in a comment in his native language, using some UTF characters, that have varying size (then one character != one byte). Other than that there are also some differences in the filesystem the file is stored on; usually the smallest unit that can be allocated on a hard disk drive is specified and file sizes will always be a multiple of this number.