Coder Social home page Coder Social logo

files_zip's Introduction

Zipper

REUSE status

Create zip archives from one or multiple files from within Nextcloud. The archive will be created in the background during cron job execution, so make sure that you have setup a regular cron job. Once the file has been created, the user will be notified about that.

Usage

After installing and enabling the Zipper app, a new contextual menu option labeled Compress to Zip will appear when right-clicking a file or folder as well as under the ...Actions menu at the top of the file list in the Nextcloud Web inteface. A notification will be generated immediately for the user to inform them that the zip file creation is pending (queued). An additional notification will be generated when the zip file is available for download.

Development

The app requires frontend code build in order to run it from the git repostitory:

  • Install dependencies: npm ci
  • Build the app npm run build

API

Capabilities Endpoint

The Capabilities endpoint will announce the possibility to create zip files through the API with the available API version. Currently only v1 is available.

  "files_zip": {
    "apiVersion": "v1"
  },

Scheduling a zip file creation

POST /ocs/v2.php/apps/files_zip/api/v1/zip

Parameters:

  • fileIds: (int[]) List of file ids to add to the archive, e.g. [18633,18646,18667]
  • target: (string) Full path of the target zip file in the user directory, e.g. /path/to/file.zip

Configuration

Limiting File Size

In some cases it might be wanted to limit the maximum size of files in total that may be added to zip files. That might be for example useful if the amount of space on /tmp needs to be calculated in order to have enough space for compression.

Setting the limit to 1GB (in bytes):

occ config:app:set files_zip max_compress_size --value=1073741824

The default value is unlimited (-1).

files_zip's People

Contributors

andyscherzinger avatar carlschwan avatar come-nc avatar danxuliu avatar dependabot[bot] avatar icewind1991 avatar joshtrichards avatar juliushaertl avatar max-nextcloud avatar mejo- avatar nextcloud-bot avatar nickvergessen avatar pvince81 avatar pytal avatar rakekniven avatar rullzer avatar skjnldsv avatar valdnet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

files_zip's Issues

icon in Actions menu does not play nice in dark theme

This is really just a nice-to-have: using a dark theme, the icon that appears in the Actions menu, once you have selected files, is hard to see, as it is black on a dark gray background. I suppose that there must be a way of providing two sets of icons, one for light themes and one for dark ones.

Unable to zip files

Hi,
i have a self hosted nextcloud. I installed zipper, but i am not able to zip files. I become the notification, that the zip file will be created, but the zip file never appear or will be finished.
I tried the same on a nextcloud from hetzner, and that works fine. So i think, it's a configuration issue of nextcloud or i need an extension or similar?
I didn't find a log with the information too.
I hope you can help me.

Best regards

Add tests

  • Basic feature tests #85
  • Cypress acceptance tests

Translations Issue

Hello,
I don't understand when I go to my files on my instance and I click to create a ZIP, the text is in English while the translations of the application are good.

unzip files

maybe it would be possible to unzip files

TypeError: Unsupported operand types: array & float

After trying to create a ZIP archive from a folder name "@ABCTEST2024", the creation process fails. Same for other attemps with a) a single file and b) a set of single files.

ZIP files are created, but empty (size of 0 KB).

Let me know which information is needed. Does this app rely on 64 bit OS maybe?

[files_zip] Fehler: TypeError: Unsupported operand types: array & float at <<closure>>

 0. /var/www/nextcloud/3rdparty/deepdiver/zipstreamer/src/ZipStreamer.php line 387
    ZipStreamer\pack64le()
 1. /var/www/nextcloud/3rdparty/deepdiver/zipstreamer/src/ZipStreamer.php line 396
    ZipStreamer\ZipStreamer->buildZip64ExtendedInformationField()
 2. /var/www/nextcloud/3rdparty/deepdiver/zipstreamer/src/ZipStreamer.php line 343
    ZipStreamer\ZipStreamer->buildLocalFileHeader()
 3. /var/www/nextcloud/3rdparty/deepdiver/zipstreamer/src/ZipStreamer.php line 212
    ZipStreamer\ZipStreamer->beginFile()
 4. /var/www/nextcloud/apps/files_zip/lib/Service/ZipService.php line 212
    ZipStreamer\ZipStreamer->addFileFromStream()
 5. /var/www/nextcloud/apps/files_zip/lib/Service/ZipService.php line 192
    OCA\FilesZip\Service\ZipService->addFile()
 6. /var/www/nextcloud/apps/files_zip/lib/Service/ZipService.php line 206
    OCA\FilesZip\Service\ZipService->addNode()
 7. /var/www/nextcloud/apps/files_zip/lib/Service/ZipService.php line 188
    OCA\FilesZip\Service\ZipService->addFolder()
 8. /var/www/nextcloud/apps/files_zip/lib/Service/ZipService.php line 131
    OCA\FilesZip\Service\ZipService->addNode()
 9. /var/www/nextcloud/apps/files_zip/lib/BackgroundJob/ZipJob.php line 68
    OCA\FilesZip\Service\ZipService->zip()
10. /var/www/nextcloud/lib/public/BackgroundJob/Job.php line 81
    OCA\FilesZip\BackgroundJob\ZipJob->run()
11. /var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php line 57
    OCP\BackgroundJob\Job->start()
12. /var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php line 47
    OCP\BackgroundJob\QueuedJob->start()
13. /var/www/nextcloud/cron.php line 152
    OCP\BackgroundJob\QueuedJob->execute()

at 2024-01-19T21:15:04+01:00

By the way needing to wait for the cron run is a big downside of this app (5 minutes can be a long time).
Why not start instantly with creation, especially when there's a ZIP queue and no other progress is running currently?

Add UI

This action needs to be added to the webui

No user guide

I installed this and can find no instructions as to how to use it from the GUI. Perhaps it is command line only ?

Installing when running PHP7.4 breaks Nextcloud

On a Nextcloud server running on Debian Bullseye with PHP7.4 installing files_zip results in a requirement for PHP8.0 which causes Nextcloud to only serve HTTP 500 errors, when using occ there is this message:

Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.33.

Error while Zipping when root folder is read only: `No create permission for path`

Just tried the app and I got the following issue:

{
  "reqId": "ddnrK6weTbpLI0qMPo7o",
  "level": 3,
  "time": "2021-11-19T00:55:02+01:00",
  "remoteAddr": "",
  "user": "--",
  "app": "files_zip",
  "method": "",
  "url": "--",
  "message": "Failed to create zip archive",
  "userAgent": "--",
  "version": "22.2.3.0",
  "exception": {
    "Exception": "OCP\\Files\\NotPermittedException",
    "Message": "No create permission for path",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/files_zip/lib/Service/ZipService.php",
        "line": 92,
        "function": "newFile",
        "class": "OC\\Files\\Node\\Folder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_zip/lib/BackgroundJob/ZipJob.php",
        "line": 65,
        "function": "zip",
        "class": "OCA\\FilesZip\\Service\\ZipService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
        "line": 79,
        "function": "run",
        "class": "OCA\\FilesZip\\BackgroundJob\\ZipJob",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php",
        "line": 47,
        "function": "execute",
        "class": "OCP\\BackgroundJob\\Job",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/cron.php",
        "line": 127,
        "function": "execute",
        "class": "OCP\\BackgroundJob\\QueuedJob",
        "type": "->"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
    "Line": 209,
    "CustomMessage": "Failed to create zip archive"
  },
  "id": "6196e81a535c6"
}

It has most likely the same reason why nextcloud/server#25787 happened.

Whats this?

Hello,

i found this in the code:

                    Ht = "\t\n\v\f\r    �          � \u2028\u2029\ufeff",
                    Jt = "[" + Ht + "]",
                    Xt = RegExp("^" + Jt + Jt + "*"),
                    Kt = RegExp(Jt + Jt + "*$"),
                    Yt = function(t) {
                        return function(e) {
                            var n = String(b(e));
                            return 1 & t && (n = n.replace(Xt, "")), 2 & t && (n = n.replace(Kt, "")), n
                        }
                    },

What does it do?
It looks like its some sort of Obfuscation

[Suggestion] Why can't this be released as an app?

The ability to zip files / folders from within the Nextcloud webinterface would be awesome (for example, I have large archives with many subdirectories on my Nextcloud, looking through changes in each of those directories often tanks my Nextcloud's performance, my only known current solution would be to download this entire archive, zip it, then upload it again, which just does not seem ideal!)

Simply an option within the actions menu to zip a file / folder would be nice!

Edit: I am stupid, it is an app:
https://apps.nextcloud.com/apps/files_zip

[F2V] Migrate to new file actions API

https://github.com/nextcloud/files_zip/blob/main/src/main.js should be migrated to the new file actions API.

https://nextcloud.github.io/nextcloud-files/functions/registerFileAction.html
https://nextcloud.github.io/nextcloud-files/classes/FileAction.html

@skjnldsv Can you share some light on the plans for backward compatibility of the file action APIs? Are there any compatibility layers planned or in place to put the old actions in the new action menu or the other way round? Anything else to be aware of apart from the api docs?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.