NW.MetaLinks 1.0.0

dotnet add package NW.MetaLinks --version 1.0.0
                    
NuGet\Install-Package NW.MetaLinks -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NW.MetaLinks" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NW.MetaLinks" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NW.MetaLinks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NW.MetaLinks --version 1.0.0
                    
#r "nuget: NW.MetaLinks, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NW.MetaLinks@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NW.MetaLinks&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NW.MetaLinks&version=1.0.0
                    
Install as a Cake Tool

NW.MetaLinks is a library that creates MetaLink v4 strings from user-provided URLs and their corresponding filenames for delegating downloads to external applications such as JDownloader.

Getting Started

If /home/nw.metalinks is the folder in which the .nupkg file is located, you can install it using this command:

dotnet add package NW.MetaLinks --source /home/nw.metalinks

The Typical Use Case

In order to use the library, the first thing we need to do is to create a list of download URLs and a list containing their corresponding filenames, and then pass them to the CreateMetaLink4 method of a MetaLinkFactory object, as shown in the following example:

using System;
using System.Collections.Generic;
using System.IO;
using NW.MetaLinks;

...

List<Uri> urls = new List<Uri>() {
    new Uri("https://example.com/files/document.pdf"),
    new Uri("https://example.com/files/archive.zip")
};

List<string> fileNames = new List<string>() {
    "document.pdf",
    "archive.zip"
};

IMetaLinkFactory factory = new MetaLinkFactory();

string metaLink = factory.CreateMetaLink4(
    packageName: "My Package",
    urls: urls,
    fileNames: fileNames
);

File.WriteAllText(
    path: "my-package.metalink",
    contents: metaLink
);

...

Note: urls and fileNames must contain the same number of items.

As alternative:

using System;
using System.Collections.Generic;
using NW.MetaLinks;

...

List<Tuple<Uri, string>> files = new List<Tuple<Uri, string>>() {
    Tuple.Create(
        new Uri("https://example.com/files/document.pdf"),
        "document.pdf"
    ),
    Tuple.Create(
        new Uri("https://example.com/files/archive.zip"),
        "archive.zip"
    )
};

IMetaLinkFactory factory = new MetaLinkFactory();

string metaLink = factory.CreateMetaLink4(
    packageName: "My Package",
    files: files
);

Here is a minimal example of a MetaLink v4 file:

<?xml version="1.0" encoding="UTF-8"?>
<metalink xmlns="urn:ietf:params:xml:ns:metalink" version="4.0">
  <identity>My Package Name</identity>

  <file name="example.bin">
    <url>https://example.com/example.bin</url>
  </file>
</metalink>

Even if it's a XML file under the hood, a MetaLink file is expected to have the .metalink extension (instead of .xml).

JDownloader has full support for the MetaLink v4 format, but it's worth mentioning that by default, once the user imports a MetaLink file, JDownloader will ping all the files inside it, to check for their online status.

When importing a MetaLink file with hundreds or thousands of links inside, could flood the website and bring the provider to blacklist your IP address.

Before importing a MetaLink file, it could be a good practice to disable the Do Link Check feature:

  1. Open JDownloader 2.
  2. Go to SettingsAdvanced Settings.
  3. Locate the setting: LinkCollector: Do Link Check
  4. Untick (disable) this option.
  5. Done!

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 100 8/2/2026