SecureBlackbox 2020 Python Edition

Questions / Feedback?

on_prepare_file Event

Fires for every file to be compressed before the compression starts.

Syntax

class ArchiveWriterPrepareFileEventParams(object):
  @property
  def path() -> str: ...
  @property
  def file_size() -> int: ...
  @property
  def data_source() -> int: ...
  @data_source.setter
  def data_source(value) -> None: ...
  @property
  def local_path() -> str: ...
  @local_path.setter
  def local_path(value) -> None: ...
  @property
  def action() -> int: ...
  @action.setter
  def action(value) -> None: ...

# In class ArchiveWriter:
@property
def on_prepare_file() -> Callable[[ArchiveWriterPrepareFileEventParams], None]: ...
@on_prepare_file.setter
def on_prepare_file(event_hook: Callable[[ArchiveWriterPrepareFileEventParams], None]) -> None: ...

Remarks

Class fires this event for every file included in the files collection before commencing the compression. This is the last opportunity for your code to adjust the action to be taken for each file and tune up the data sources appropriately.

The Path parameter contains the path to the file within the archive (such as Photos/myphoto.jpg), and the FileSize contains the size of that file before compression.

The DataSource parameter indicates the media from which the file contents is to be taken. A typical default value if fdsFile, but you can adjust the value of that parameter if you need to use an alternative source. The following options are available:

fdsFile (0)The data will be taken from a file indicated by the LocalPath parameter. You can change this path in this event handler.
fdsStream (1)The file data will be taken from a stream assigned to file_stream property.
fdsBuffer (2)The data will be taken from a buffer attached to the file_data property.

Please do not assign file_stream or file_data in this event handler: this should be done further down the road in the on_before_compress_file event handler. The purpose of this event is to prepare the compression plan by summarizing what should be done and to which files.

The Action parameter, which is also tuneable, indicates the action for class to take on the file:

atAdd (0)Add the file to the archive
atKeep (1)Keep the existing file in the archive
atUpdate (2)Update the archived file with a fresher copy
atDelete (3)Delete the file from the archive
atExtract (4)Extract the file (extraction only)
atSkip (5)Skip file extraction (extraction only)

Copyright (c) 2022 /n software inc. - All rights reserved.
SecureBlackbox 2020 Python Edition - Version 20.0 [Build 8154]