Skip to content

Add Support for Custom Extension in reassemble_file() #110

@hbisneto

Description

@hbisneto

The reassemble_file() function currently uses the fixed .fsp extension when searching for split file parts.
To improve flexibility and allow developers to define their own part extensions, a new parameter should be added to the function.

Current Behavior

while os.path.exists(f'{large_file}.fsp{str(i)}'):
    parts.append(f'{large_file}.fsp{str(i)}')

The .fsp extension is hardcoded, which limits the ability to use other naming schemes.

Expected Behavior

Add an optional extension parameter to the function:

def reassemble_file(large_file, new_file, extension=".fsp"):

This parameter allows custom extensions to be specified, e.g.:

reassemble_file("large_file", "new_file", extension=".part")

Acceptance Criteria

  • Add extension parameter to reassemble_file() with a default value of .fsp.
  • Replace hardcoded .fsp usage with the new parameter.
  • Update the function docstring to document the new parameter.
  • Keep backward compatibility with existing code.
  • Add examples showing usage with custom extensions.

Example

# Default behavior
reassemble_file("archive", "archive_restored")

# Custom extension
reassemble_file("archive", "archive_restored", extension=".chunk")

Additional Context

This change improves flexibility for users who rely on different file-naming conventions during the split/reassemble process.

Metadata

Metadata

Assignees

Labels

File ModuleRelated to the "File" module inside FileSystemProenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions