getPropertyFile

Reads a Java properties file and returns all of its key-value pairs as a struct.

getPropertyFile(filepath [, encoding]) → returns struct

Argument Reference

filepath string
Required

Absolute path to the properties file.

encoding string
Default: utf-8

Character encoding of the file.

Examples
Sample code invoking the getPropertyFile function

path = getTempDirectory() & "app.properties";
fileWrite(path, "a=1#chr(10)#b=hello");
writeOutput(serializeJSON(getPropertyFile(path)));

Expected Result: {"a":"1","b":"hello"}

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub