https://github.com/xjonathanlei/cookiestxtparser
A cookies.txt parser library for .NET Standard
https://github.com/xjonathanlei/cookiestxtparser
c-sharp cookies netstandard
Last synced: about 1 year ago
JSON representation
A cookies.txt parser library for .NET Standard
- Host: GitHub
- URL: https://github.com/xjonathanlei/cookiestxtparser
- Owner: xJonathanLEI
- Created: 2020-06-04T04:56:39.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-04T08:05:47.000Z (about 6 years ago)
- Last Synced: 2025-06-03T13:43:01.815Z (about 1 year ago)
- Topics: c-sharp, cookies, netstandard
- Language: C#
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Cookies.txt Parser for .NET
## Introduction
A simple library for parsing cookies.txt files, Netscape HTTP Cookie File format used by tools like curl and wget, into:
- `System.Net.CookieCollection` for use by `HttpClient`
- `IReadOnlyList` for inspection (since it's difficult to enumerate a `CookieCollection`)
## Installation
The package is available at [NuGet](https://www.nuget.org/packages/CookiesTxtParser):
dotnet add package CookiesTxtParser
## Usage
Parse a file by path:
// To CookieCollection
CookiesTxt.Parser.ParseFileAsCookieCollection("/path/to/cookies.txt");
// To IReadOnlyList
CookiesTxt.Parser.ParseFileAsCookies("/path/to/cookies.txt");
Parse a stream:
// To CookieCollection
CookiesTxt.Parser.ParseStreamAsCookieCollection(stream);
// To IReadOnlyList
CookiesTxt.Parser.ParseStreamAsCookies(stream);