cbfs
  • Introduction
  • Intro
    • Release History
    • About This Book
  • Getting Started
    • Installation
    • Providers
      • Local Provider
      • RAM Provider
      • S3 Provider
  • Usage
    • Disk Service
    • Disk Usage
      • Configuration Methods
      • File Methods
      • File Object
      • Directory Methods
      • Utility Methods
      • Stream Methods
      • Verification Methods
  • Digging Deeper
    • Interceptors
    • Module Disks
    • Custom Providers
Powered by GitBook
On this page
  • Injection DSL
  • Helper Method
  • Core Methods
  • count()
  • defaultDisk()
  • get( name )
  • getDiskRecord( name )
  • has( name )
  • names()
  • register( name, provider, properties, override )
  • shutdown()
  • tempDisk()
  • unregister( name )

Was this helpful?

Edit on GitHub
Export as PDF
  1. Usage

Disk Service

cbfs includes a Disk Service object you can use to register and interact with your disks.

PreviousS3 ProviderNextDisk Usage

Last updated 2 years ago

Was this helpful?

dThe full API for the Disk Service can be found in the .

Injection DSL

The cbfs module registers a WireBox injection DSL that you can use to inject objects from the module.

DSL
Description

cbfs

Inject the Disk Service

cbfs:disks

Inject the entire disk records

cbfs:disks:{name}

Inject a specific disk instance by {name}

// Injects the DiskService
diskService = getInstance( "cbfs" );
property name="diskService" inject="cbfs";

diskService = getInstance( "DiskService@cbfs" );
property name="diskService" inject="DiskService@cbfs";

// Injects the entire disks record structure
disks = getInstance( "cbfs:disks" );
property name="disks" inject="cbfs:disks";

// Injects a specific disk by name
tempDisk = getInstance( "cbfs:disks:{name}" );
tempDisk = getInstance( "cbfs:disks:temp" );
property name="tempDisk" inject="cbfs:disks:temp";

Helper Method

The cbfs module registers a helper method called cbfs( diskName ) that you can use in your handlers, layouts, and views to get an instance of a specific disk:

// SomeHandler.cfc
component {
    function index( event, rc, prc ) {
        var storage = cbfs( "RamDisk" );
        var files = storage.allFiles();
    }
}

Core Methods

count()

Returns the count of registered disks.

defaultDisk()

Return an instance of the default disk defined in your configuration.

get( name )

Returns requested disk instance. Throws InvalidDiskException if the disk is not registered.

getDiskRecord( name )

Returns struct of details for a disk.

has( name )

Returns true if the disk has been registered with the provided name.

names()

Returns an array of registered disk names.

register( name, provider, properties, override )

Registers a new disk. If a disk has already been configured with the same name, then it will not be updated unless you specify override=true.

shutdown()

Unregisters and shuts down all disks managed by the DiskService.

tempDisk()

Returns the temporary disk.

unregister( name )

Unregisters a disk. Throws InvalidDiskException if the disk is not registered.

API Docs