Giter Site home page Giter Site logo

Comments (5)

karan1149 avatar karan1149 commented on June 20, 2024 3

Also having this issue.

from nativescript-background-http.

roblav96 avatar roblav96 commented on June 20, 2024 1

@NickIliev I have not tried using this since the original post up top.

I ended up wiping together something small using AFNetworking:

private static _downloadData(): Promise<NSURL> {
    return new Promise(function(resolve, reject) {
        let file: string = 'Archive'
        let config: NSURLSessionConfiguration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier('com.roblav96.sandbox')
        let manager: AFURLSessionManager = AFURLSessionManager.new().initWithSessionConfiguration(config)
        let url: NSURL = NSURL.URLWithString(IP + '/tessdata/' + file + '.zip')
        let request: NSURLRequest = NSURLRequest.requestWithURL(url)
        let downloadTask: NSURLSessionDownloadTask = manager.downloadTaskWithRequestProgressDestinationCompletionHandler(
            request,
            function downloadProgressBlock(progress: NSProgress) {
                let value: number = Math.min(progress.completedUnitCount / progress.totalUnitCount, 99)
                TesseractClass.emitter.emit('progress', value)
            },
            function destination(targetPath: NSURL, response: NSURLResponse): NSURL {
                let tessdata: Folder = knownFolders.temp().getFolder('tessdata')
                let nsurl: NSURL = NSURL.fileURLWithPath(tessdata.path + '/' + file + '.zip')
                return nsurl
            },
            function completionHandler(response: NSURLResponse, filePath: NSURL, nserror: NSError) {
                if (nserror) {
                    let error: any = (nserror.description) ? nserror.description : nserror
                    global.tnsconsole.error('downloadData > error', error)
                    reject(error)
                } else {
                    resolve(filePath)
                }
            }
        )
        downloadTask.resume()
    })
}

I'll check this and see if it's working. I'm always deving on @next everything.

from nativescript-background-http.

roblav96 avatar roblav96 commented on June 20, 2024 1

@NickIliev I can confirm that the latest version works flawless on android and ios :D

from nativescript-background-http.

NickIliev avatar NickIliev commented on June 20, 2024

Hey @roblav96 , @karan1149 did you guys still reproduce this with the latest version of the plugin and the tis-core-modules?

from nativescript-background-http.

shivgolani avatar shivgolani commented on June 20, 2024

@roblav96 can you help me if I want to download multiple files. Your code is allowing only single file download.

from nativescript-background-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.