Skip to content

Question: Why not embrace the usage of read streams? #1

@Pato05

Description

@Pato05

Hi! I'm very interested in this package since it's the first time that I'm noticing a file picker which actually exports a stream (via saf_stream on Android) instead of copying the file to a temporary location.
I was wondering, why not drop file_selector entirely, and make it easier to access the read streams on the public APIs, and keep the usage of packages like saf_stream entirely on the backend?

For example, there could be a method file.openRead(), which takes these actions:

  • on Android, it makes an internal call to saf_stream and returns this stream
  • on iOS and MacOS, it returns a custom stream which:
    • on first read it makes a call to startAccessingSecurityScopedResourceWithURL(uri), and continues streaming the file via File(path).openRead()
    • on close, it makes a call to stopAccessingSecurityScopedResourceWithURL(uri)
  • on Web: some inspiration can be taken from file_picker, which seems to make great use of ArrayBuffer to convert the file to a readable stream
  • on Windows/Linux: there would be no particular limits from simply using File(path).openRead().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions