public static PBIFile OpenFile(Stream fileStream)
        {
            CheckFileStream(fileStream);

            var pbiFile = new PBIFile(fileStream);

            pbiFile.Initialise();

            return(pbiFile);
        }
        public static PBIFile OpenFile(string path)
        {
            CheckFilePath(path);

            var fileData   = File.ReadAllBytes(path);
            var fileStream = new MemoryStream(fileData);

            var pbiFile = new PBIFile(fileStream);

            pbiFile.Initialise();

            return(pbiFile);
        }
        public static async Task <PBIFile> OpenFileAsync(string path, CancellationToken cancellationToken = default)
        {
            CheckFilePath(path);

            var fileData = await File.ReadAllBytesAsync(path, cancellationToken);

            var fileStream = new MemoryStream(fileData);

            var pbiFile = new PBIFile(fileStream);

            pbiFile.Initialise();

            return(pbiFile);
        }
        public static async Task <PBIFile> OpenFileAsync(Stream fileStream, CancellationToken cancellationToken = default)
        {
            CheckFileStream(fileStream);

            var memoryStream = new MemoryStream();
            await fileStream.CopyToAsync(memoryStream, cancellationToken);

            memoryStream.Position = 0;

            var pbiFile = new PBIFile(memoryStream);

            pbiFile.Initialise();

            return(pbiFile);
        }