Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to cache a local file with a specified path? #79

Open
Ruddch opened this issue May 22, 2023 · 0 comments
Open

Is there a way to cache a local file with a specified path? #79

Ruddch opened this issue May 22, 2023 · 0 comments

Comments

@Ruddch
Copy link

Ruddch commented May 22, 2023

I would like to have a similar capability, but due to the privacy of the methods, it is not possible.

static func cacheVideo(
      localURL: URL,
      remoteURL: URL
    ) async {      
      guard let data = try? Data(contentsOf: localURL) else { return }
      let fileManager = FileManager.default
      let filePath = VideoCacheManager.cachedFilePath(for: remoteURL)
      do {
        try fileManager.copyItem(atPath: localURL.path, toPath: filePath)
        let config = try VideoCacheManager.cachedConfiguration(for: remoteURL)
        config.add(fragment: 0..<data.count)
        config.save()
      } catch {
        print(error)
      }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant