def to_zip(self, path, *, encoder_class=None):
    'Save package to a zip\n\n        Parameters:\n            path (str): target path\n            encoder_class (object): json encoder class\n\n        Raises:\n            FrictionlessException: on any error\n        '
    try:
        with zipfile.ZipFile(path, 'w') as archive:
            package_descriptor = self.to_dict()
            for (index, resource) in enumerate(self.resources):
                descriptor = package_descriptor['resources'][index]
                if resource.remote:
                    pass
                elif resource.memory:
                    if (not isinstance(resource.data, list)):
                        path = f'{resource.name}.csv'
                        descriptor['path'] = path
                        del descriptor['data']
                        with tempfile.NamedTemporaryFile() as file:
                            tgt = Resource(path=file.name, format='csv', trusted=True)
                            resource.write(tgt)
                            archive.write(file.name, path)
                elif resource.multipart:
                    for (path, fullpath) in zip(resource.path, resource.fullpath):
                        if os.path.isfile(fullpath):
                            if (not helpers.is_safe_path(fullpath)):
                                note = f'Zipping usafe "{fullpath}" is not supported'
                                error = errors.PackageError(note=note)
                                raise FrictionlessException(error)
                            archive.write(fullpath, path)
                else:
                    path = resource.path
                    fullpath = resource.fullpath
                    if os.path.isfile(fullpath):
                        if (not helpers.is_safe_path(fullpath)):
                            note = f'Zipping usafe "{fullpath}" is not supported'
                            error = errors.PackageError(note=note)
                            raise FrictionlessException(error)
                        archive.write(fullpath, path)
            archive.writestr('datapackage.json', json.dumps(package_descriptor, indent=2, ensure_ascii=False, cls=encoder_class))
    except Exception as exception:
        error = errors.PackageError(note=str(exception))
        raise FrictionlessException(error) from exception
Save package to a zip

Parameters:
    path (str): target path
    encoder_class (object): json encoder class

Raises:
    FrictionlessException: on any error
def to_zip(self, path, *, encoder_class=None):
    'Save package to a zip\n\n        Parameters:\n            path (str): target path\n            encoder_class (object): json encoder class\n\n        Raises:\n            FrictionlessException: on any error\n        '
    try:
        with zipfile.ZipFile(path, 'w') as archive:
            package_descriptor = self.to_dict()
            for (index, resource) in enumerate(self.resources):
                descriptor = package_descriptor['resources'][index]
                if resource.remote:
                    pass
                elif resource.memory:
                    if (not isinstance(resource.data, list)):
                        path = f'{resource.name}.csv'
                        descriptor['path'] = path
                        del descriptor['data']
                        with tempfile.NamedTemporaryFile() as file:
                            tgt = Resource(path=file.name, format='csv', trusted=True)
                            resource.write(tgt)
                            archive.write(file.name, path)
                elif resource.multipart:
                    for (path, fullpath) in zip(resource.path, resource.fullpath):
                        if os.path.isfile(fullpath):
                            if (not helpers.is_safe_path(fullpath)):
                                note = f'Zipping usafe "{fullpath}" is not supported'
                                error = errors.PackageError(note=note)
                                raise FrictionlessException(error)
                            archive.write(fullpath, path)
                else:
                    path = resource.path
                    fullpath = resource.fullpath
                    if os.path.isfile(fullpath):
                        if (not helpers.is_safe_path(fullpath)):
                            note = f'Zipping usafe "{fullpath}" is not supported'
                            error = errors.PackageError(note=note)
                            raise FrictionlessException(error)
                        archive.write(fullpath, path)
            archive.writestr('datapackage.json', json.dumps(package_descriptor, indent=2, ensure_ascii=False, cls=encoder_class))
    except Exception as exception:
        error = errors.PackageError(note=str(exception))
        raise FrictionlessException(error) from exception