NAME
Kernel::System::VirtualFS – virtual filesystem lib
DESCRIPTION
All virtual filesystem functions.
PUBLIC INTERFACE
new()
Don't use the constructor directly, use the ObjectManager instead:
my $VirtualFSObject = $Kernel::OM->Get('Kernel::System::VirtualFS');
Read()
read a file from virtual file system
my %File = $VirtualFSObject->Read(
Filename => '/Object/some/name.txt',
Mode => 'utf8',
# optional
DisableWarnings => 1,
);
returns
my %File = (
Content => $ContentSCALAR,
# preferences data
Preferences => {
# generated automatically
FilesizeRaw => 12345,
# optional
ContentType => 'text/plain',
ContentID => '<some_id@example.com>',
ContentAlternative => 1,
SomeCustomParams => 'with our own value',
},
);
Write()
write a file to virtual file system
my $Success = $VirtualFSObject->Write(
Content => \$Content,
Filename => '/Object/SomeFileName.txt',
Mode => 'binary' # (binary|utf8)
# optional, preferences data
Preferences => {
ContentType => 'text/plain',
ContentID => '<some_id@example.com>',
ContentAlternative => 1,
SomeCustomParams => 'with our own value',
},
);
Delete()
delete a file from virtual file system
my $Success = $VirtualFSObject->Delete(
Filename => '/Object/SomeFileName.txt',
# optional
DisableWarnings => 1,
);
Find()
find files in virtual file system
only for file name
my @List = $VirtualFSObject->Find(
Filename => '/Object/some_what/*.txt',
);
only for preferences
my @List = $VirtualFSObject->Find(
Preferences => {
ContentType => 'text/plain',
},
);
for file name and for preferences
my @List = $VirtualFSObject->Find(
Filename => '/Object/some_what/*.txt',
Preferences => {
ContentType => 'text/plain',
},
);
Returns:
my @List = (
'/Object/some/file.txt',
'/Object/my.pdf',
);
FileBulkLookup()
returns internal meta information, unique file id, where and with what arguments the file is stored
my $Result = $Self->FileBulkLookup( ['/Object/SomeFile.txt', 'Object/FileNotExists.txt', '/Object/my.pdf'] );
Returns:
my $Result = {
"/Object/my.pdf" => {
Backend => "Kernel::System::VirtualFS::DB",
BackendKey => "Compress=0;Crypt=0;FileID=3;Mode=binary;",
FileID => 3,
Filename => "/Object/my.pdf",
},
"/Object/SomeFile.txt" => {
Backend => "Kernel::System::VirtualFS::DB",
BackendKey => "Compress=0;Crypt=0;FileID=2;Mode=utf8;",
FileID => 2,
Filename => "/Object/SomeFile.txt",
},
};