Skip to content

Make the file-system module run in a background thread [$300] #2239

Closed

Description

@sebawita

Calling file-sytem -> writeText is freezing the UI of my apps until the write process is complete. Even the ActivityIndicator freezes during that time.
This is a big issue when saving big chunks of data which can take between 10 to 60 seconds to write.

I have tested it on Android with NativeScript 2.0.1

To solve that it would be great if the write functionality could run in a background thread, just like it is done for the http module.

Here is the scenario where I need to save big chunks of data.
The app I am building uses Lokijs for Offline Storage mechanism, where I store 50k records from different tables. When I call save database, the LokiNativeScriptAdapter uses file-system module to save the data to a file, which takes up to 60 seconds.


There is a $300 open bounty on this issue. Add to the bounty at Bountysource.

Activity

  1. NordlingDev commented on Jun 26, 2016

    @NordlingDev

    Question, is this the same thing as imageSource.setNativeSource() function? I am trying to make a photo library using a forEach method that creates a stack of photos from the iOS Photos library. Problem is that the app freezes until every photo has been rendered in the UI. If I only console.log each photo using the same procedure, the logs come out one by one as opposed to the UI that waits until every photo is loaded.

  2. farfromrefug commented on Oct 17, 2018

    @farfromrefug
    Collaborator

    I will bump that issue cause i feel it is kind of very big issue in Nativescript.
    File are read in the main thread:
    https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/file-system/file-system-access.android.ts#L241

    Images are read on the main thread:

    public getImageAsync(callback: (image, error) => void) {

    All that makes for a pretty bad navigation experience.
    This all should be implemented in in the native lib.

  3. changed the title [-]Make the file-system module run in a background thread[/-] [+]Make the file-system module run in a background thread [$300][/+] on Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions