VirtualFS#
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',
);