function varargout = unzip(zipFilename,varargin)

narginchk(1,2);
nargoutchk(0,1);

[zipFilename,varargin{1:nargin-1}] = convertStringsToChars(zipFilename,varargin{:});

cleanUpUrl = [];
% Argument parsing.
[zipFilename, outputDir, url, urlFilename] = matlab.io.internal.archive.parseUnArchiveInputs( ...
    mfilename, zipFilename, {'zip'}, 'ZIPFILENAME', varargin{:});

if url && ~isempty(urlFilename) && exist(urlFilename,'file')
    cleanUpUrl = urlFilename;
end

% Extract ZIP contents.
try
    cleanUpObject = onCleanup(@()cellfun(@(x)x(), {@()delete(cleanUpUrl)}));
    files = matlab.io.internal.archive.core.builtin.extractArchive(zipFilename, outputDir, 'zip');
catch extractArchiveException
    throwAsCaller(extractArchiveException);
end

if nargout == 1
    files = matlab.io.internal.archive.cleanupWindowsPathname(files);
    varargout{1} = files;
end

%   Copyright 1984-2023 The MathWorks, Inc.