Generates a checksum for a file in different hashing algorithms.
/** * @path The file path * @algorithm Default is MD5, but SHA-1, SHA-256, and SHA-512 can also be used. * * @throws cbfs.FileNotFoundException */string functionchecksum( required path, algorithm ="MD5" );// Exampledisk.checksum( expandPath( "myFile.txt" ),"SHA-256" );
chmod
Sets the access attributes of the file on Unix-based disks.
/** * @path The file path * @mode Access mode, the same attributes you use for the Linux command `chmod` * * @return cbfs.models.IDisk */functionchmod( required string path, required string mode );// Exampledisk.chmod( expandPath( "myFile.txt" ),"600" );
createSymbolicLink
Creates a symbolic link in the system if it supports it. The target parameter is the target of the link. It may be an absolute or relative path and may not exist. When the target is a relative path, then file system operations on the resulting link are relative to the path of the link.
/** * @link The path of the symbolic link to create * @target The target of the symbolic link * * @return cbfs.models.IDisk * * @throws cbfs.FileNotFoundException - if the target does not exist * @throws UnsupportedOperationException - if the implementation does not support symbolic links */functioncreateSymbolicLink( required link, required target );// Exampledisk.createSymbolicLink( expandPath( "/symbolicPath" ),expandPath( "/myfolder" ) );
Returns information about the file. Will contain keys such as lastModified, size, path, name, type, canWrite, canRead, isHidden, and more depending on the provider used.
/** * @path The file path * * @return A struct of file metadata according to provider * * @throws cbfs.FileNotFoundException */struct functioninfo( required path );// Exampledisk.info( expandPath( "myFile.txt" ) );
/** * @path The file path to build the url for * @expiration The number of minutes this url should be valid for. * @responseHeaders A struct of headers to be forced for the HTTP response of GET requests. Valid options are content-type, content-language, cache-control, content-disposition, content-encoding * * @throws cbfs.FileNotFoundException */string functiontemporaryUrl( required path, numeric expiration, struct responseHeaders );// Exampledisk.temporaryUrl( expandPath( "myFile.txt",60 ) );
With the S3 provider, you can specify a struct of response headers to control the URL constructed. For example, to generate a URL that ensures a file is returned with the MIME type 'text/plain', you could pass that into temporaryURL().
/** * Get the full url for the given file * * @path The file path to build the uri for * * @throws cbfs.FileNotFoundException */string functionurl( required string path )