NodeSwap/NodeJsWebApi.cs
/// <summary>
/// Get the latest Node version matching a given prefix.
/// </summary>
/// <exception cref="ArgumentException"></exception>
Get the latest Node version matching a given prefix.
Get the latest Node version matching a given prefix .
public Version GetLatestNodeVersion(string prefix)
        {
            var reader = NodeVersionsStreamReader();
            string line;
            while ((line = reader.ReadLine()) != null)
            {
                var lineVersion = VersionParser.Parse(line.Split("\t")[0]);
                if (lineVersion.ToString().StartsWith(prefix))
                {
                    return lineVersion;
                }
            }
            throw new ArgumentException($"NodeJS distribution not found for given prefix: {prefix}");
        }
public Version GetLatestNodeVersion ( string prefix ) { var reader = NodeVersionsStreamReader ( ) ; string line ; while ( ( line = reader . ReadLine ( ) ) != null ) { var lineVersion = VersionParser . Parse ( line . Split ( " \t " ) [ 0 ] ) ; if ( lineVersion . ToString ( ) . StartsWith ( prefix ) ) { return lineVersion ; } } throw new ArgumentException ( $" NodeJS distribution not found for given prefix:  { prefix } " ) ; }
Get the latest Node version matching a given prefix.
Get the latest Node version matching a given prefix .
None
prefix
string