Nifty little trick with fileRead and ColdFusion 10

This post is more than 2 years old.

ColdFusion 10 adds a nifty little feature to the VFS (Virtual File System) - support for FTP, HTTP, and ZIP. This means you can treat remote resources and zip files as if they were simple file systems. The docs don't go into great detail on this (and instead ask you to read the Apache Commons docs instead), but I discovered a simple, but really nice, good example of this.

Because fileRead supports http, if you want to quickly grab the contents of a URL, you can use it as I've done above. All it does is save you one line of code (compared to the normal cfhttp call followed by a set to grab the file contents), but it's handy!

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA