Skip to content

[Help Wanted] How to get file size of a file to be downloaded #222

Closed
@brystfire08

Description

@brystfire08

Hi need help on getting the file size of a file from server before it is saved to the device storage. I need it to check if the device storage is at least twice enough for the file size to be saved.

Something like this:
var documentPath = dirs.DocumentDir;

RNFetchBlob.fs.stat(documentPath + '/sampleFile)
	.then((data) => {							
		RNFetchBlob.fs.df()
			.then((response) => {
				if(response.internal_free > parseInt(data.size)  * 2 ) {
					//do it
				}
				else {
					//warn
				}
		})
});

but fs.stat only works on files in device.. i think

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions