Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.
This repository was archived by the owner on Mar 21, 2026. It is now read-only.

Downloading resource files #30

Description

@mpaine-act

How do you use ScrapingBrowser to download web resource files? I would love this feature but don't see how to save to disk.

For example, I am able to achieve this by adding to ScrapingBrowser:

    public WebResource DownloadWebResourceFile(Uri url, string path, FileMode mode)
    {
        var response = ExecuteRequest(url, HttpVerb.Get, new NameValueCollection());
        var stream = new FileStream(path, mode);
        var responseStream = response.GetResponseStream();

        if (responseStream != null)
            responseStream.CopyTo(stream);

        responseStream.Close();
        return new WebResource(stream, response.Headers["Last-Modified"], url, !IsCached(response.Headers["Cache-Control"]), response.ContentType);
    }

Thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions