This release adds an option for one to retrieve information on the progress of a download, by passing a callback which matches the following type (from expo-filesystem
):
export type DownloadProgressCallback = (data: DownloadProgressData) => void;
export type DownloadProgressData = {
totalBytesWritten: number;
totalBytesExpectedToWrite: number;
};
A good example of the kind of callback you might want to pass in here is available in the README
Breaking Changes
Previously downloadToFolder
was called as follows (with the latter two arguments being optional):
await downloadToFolder(uri, filename, folder, channelId, {notification: 'custom'}, customNotificationConfig);
Now, with the new option to add a callback to retrieve download progress, the optional arguments have been grouped together
in one options
argument (with only the options
argument being optional), as follows:
await downloadToFolder(uri, filename, folder, channelId, {
notificationType: {notification: 'custom'},
notificationContent: customNotificationConfig,
downloadProgressCallback: callback,
});