Git Product home page Git Product logo

7z-wasm's People

Contributors

kichikuou avatar use-strict avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

7z-wasm's Issues

How I can get output from sevenZip.callMain(["l", ''archive.zip"])

Hello! I try to create some kind of archiver with web interface. I want to get contents of archive and show it at web page.
Does your library allow you to get the entire output of the executed command? Or I need to monkey-patch console.log and get output of command from there? Thanx for answer!

can't extract when path contains "Doc_0/Signs/Signatures.xml"

hi,
7z-wasm can't extract the zip entry when the entry's path is "Doc_0/Signs/Signatures.xml".
other entries can be extracted ok.
is it related to that the entry path contains 'sign' or something?
very wierd.
when using 1.0.2, the error message is 'Permission denied'.
when using 1.1.0, the error message is :
{
"errno": 2,
"message": "FS error"
}
1.zip

how to open file?

I can't open file on browser. code is below. why not?

<title>test.htm</title><script type=module> import SevenZip from "./7zz.es6.js"; const sevenZip=await SevenZip(); sevenZip.FS.readFile("7zz.es6.js");// report No such file or directory sevenZip.FS.readFile("C:/Users/user/Desktop/7zip7zz.es6.js");// report No such file or directory </script>

directory
C:/Users/user/Desktop/7zip
┣test.htm
┣7zz.es6.js
┗7zz,wasm.js

compile in latest emsdk

I'm trying to compile this project with latest emscripten's official docker.
I have applied patch and loaded the build-es6.env run emmake make -j -f makefile.emcc in docker, under Alone2 directory
then I got an error

../../../Windows/SystemInfo.cpp:21:10: fatal error: 'sys/auxv.h' file not found
   21 | #include <sys/auxv.h>
      |          ^~~~~~~~~~~~
1 error generated.

Fails to decompress certain types of archives

$ wget https://www.7-zip.org/a/7z1900-extra.7z
$ npx 7z-wasm x 7z1900-extra.7z

This fails with the following error message:

sigaction: signal type not supported: this is a no-op.
sigaction: signal type not supported: this is a no-op.

7-Zip (z) 21.03 beta (LE) : Copyright (c) 1999-2021 Igor Pavlov : 2021-07-20
 32-bit ILP32 locale=C.UTF-8 Threads:1

Scanning the drive for archives:
1 file, 929117 bytes (908 KiB)

Extracting archive: 7z1900-extra.7z
--
Path = 7z1900-extra.7z
Type = 7z
Physical Size = 929117
Headers Size = 532
Method = LZMA:22 BCJ2
Solid = +
Blocks = 2


ERROR: errno=6 : Resource temporarily unavailable

Archives with Errors: 1

sigaction: signal type not supported: this is a no-op.
sigaction: signal type not supported: this is a no-op.

TypeScript: "This expression is not callable"

Given a file that is only the contents:

import SevenZip from '7z-wasm';

(async (): Promise<void> => {
  const sevenZip = await SevenZip();
})();

it gives this error on the function call:

TS2349: This expression is not callable.
Type 'typeof import("<redacted>/node_modules/7z-wasm/index")' has no call signatures.

I'm on Node.js v16.17.0 and TypeScript v4.8.4.

Get error when trying to extract large files (e.g. >2gb)

I'm having issues with trying to extract large files out of an archive (e.g. around 2gb or so). Gives me a:
RangeError: Array buffer allocation failed) at Error

I'm wondering if it's got something to do with it being a 32bit build? Is it possible to compile it as 64-bit?

How to decompress from memory ?

Hi,
In the README.md shows an example to decompress from file.

How can I decompress from memory (i.e from a blob or ByteArray) ?

Thanks,

Using this to compress strings

Is it possible to use this library to compress strings

I would like to do something like this , but want to use 7z's LZMA2 to compress & decompress

Filename characters are displaying incorrectly

Filenames that contain non-English characters (e.g. ä,é,è,ö ...) are not listed correctly.

When I run normal command line 7z, it works fine:
7z l Archive.7z

I get following output:

7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs LE)

Scanning the drive for archives:
1 file, 25043856 bytes (24 MiB)

Listing archive: Archive.7z

--
Path = Archive.7z
Type = 7z
Physical Size = 25043856
Headers Size = 250
Method = LZMA2:24
Solid = +
Blocks = 1

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2022-09-17 08:23:47 ....A      6104109     25043606  image-one.png
2022-09-17 08:22:45 ....A      4844990               imagè-thréê.png
2022-09-17 08:23:25 ....A      8346941               imäge-twö.png
2022-09-17 08:22:08 ....A      5759066               ìmágé-fòûr.png
------------------- ----- ------------ ------------  ------------------------

But when I run the 7z-wasm version:
npx 7z-wasm l Archive.7z

I get following output:

7-Zip (z) 22.01 (LE) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15
 32-bit ILP32 locale=C.UTF-8 Threads:1

Scanning the drive for archives:
1 file, 25043856 bytes (24 MiB)

Listing archive: Archive.7z

--
Path = Archive.7z
Type = 7z
Physical Size = 25043856
Headers Size = 250
Method = LZMA2:24
Solid = +
Blocks = 1

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2022-09-17 08:23:47 ....A      6104109     25043606  image-one.png
2022-09-17 08:22:45 ....A      4844990               imagᅢᄄ-thrᅢ랡.png
2022-09-17 08:23:25 ....A      8346941               imᅢᄂge-twᅢᄊ.png
2022-09-17 08:22:08 ....A      5759066               ᅢᆲmᅢᄀgᅢᄅ-fᅢ배ᄏr.png
------------------- ----- ------------ ------------  ------------------------

I wonder if it has something to do with the locale? Is C.UTF-8 more restrictive? How can that be changed? Any ideas?

I cannot readFile inside Worker virtual file system

Hello, I don't know what the issue but I get good progress using your library (I created: https://extractify.zip/ which is open source now :) ),

I have the following code inside Worker and it work great to extract the files and show them in files list but I cannot read any file (except the archive file it self)

The following debug for reading specific file inside the archive:

Logs:
image

Code:

    async generateBlobUrl(file: iFile) {
        if (!this.sevenZip) return;
        file = typeof file === "string" ? JSON.parse(file) : file;

        this.sevenZip.FS.chdir("/");
        console.log("Directory content before extracting", this.sevenZip.FS.readdir("/"));

        // extract file from archive
        this.execute(['x', '-y', this.archiveName, file.path.substring(1)]);

        console.log("Directory content after extracting", this.sevenZip.FS.readdir('/'));

        console.log({
            file: file.path.substring(1),
            p: file.path
        });

        const stream = this.sevenZip.FS.open(file.path, 'r');
        const stat = this.sevenZip.FS.stat(file.path);
        const bufferLength = stat.size;
        const buffer = new Uint8Array(bufferLength);
        this.sevenZip.FS.read(stream, buffer, 0, bufferLength, 0);
        this.sevenZip.FS.close(stream);

        console.log({buffer});

        // const blob = new Blob([buffer], { type: mime.lookup(file.extension!) || "application/octet-stream" });
        // const blobUrl = URL.createObjectURL(blob);

        // console.log({blobUrl});

        return "blobUrl";
    }

The following debug for reading archive file (compressed file) inside the archive:

Logs:
image

Code:

    async generateBlobUrl(file: iFile) {
        if (!this.sevenZip) return;
        file = typeof file === "string" ? JSON.parse(file) : file;

        // override archive name as file name
        file.path = '/' + this.archiveName;

        this.sevenZip.FS.chdir("/");
        console.log("Directory content before extracting", this.sevenZip.FS.readdir("/"));

        // extract file from archive
        this.execute(['x', '-y', this.archiveName, file.path.substring(1)]);

        console.log("Directory content after extracting", this.sevenZip.FS.readdir('/'));

        console.log({
            file: file.path.substring(1),
            p: file.path
        });

        const stream = this.sevenZip.FS.open(file.path, 'r');
        const stat = this.sevenZip.FS.stat(file.path);
        const bufferLength = stat.size;
        const buffer = new Uint8Array(bufferLength);
        this.sevenZip.FS.read(stream, buffer, 0, bufferLength, 0);
        this.sevenZip.FS.close(stream);

        console.log({buffer});

        // const blob = new Blob([buffer], { type: mime.lookup(file.extension!) || "application/octet-stream" });
        // const blobUrl = URL.createObjectURL(blob);

        // console.log({blobUrl});

        return "blobUrl";
    }

"ERROR: Cannot create folder" on some archives

While trying to extract some archives in the browser environment with the

sevenZip.callMain(["x", archiveName, "-oextracted"]);

command, 7zip will simply show the following errors:

ERROR: Cannot create folder
ERROR: Cannot open output file : errno=2 : Permission denied

This only seems to happen with some archive files.

Testing with

sevenZip.callMain(["t", archiveName]);

before extraction returns an Everything is Ok message from 7zip.

Setting permissions with

sevenZip.FS.chmod(archiveName, 0o777);
sevenZip.FS.chmod("/extracted", 0o777);

also seems to have no effect either.

Here are some examples of archives that can be extracted:
https://github.com/CTCaer/hekate/releases/download/v6.0.7/hekate_ctcaer_6.0.7_Nyx_1.5.6.zip
https://github.com/Atmosphere-NX/Atmosphere/releases/download/1.6.2/atmosphere-1.6.2-master-f7bf379cf%2Bhbl-2.4.4%2Bhbmenu-3.6.0.zip

Here are some exapmles of archives that cannot be extracted:
https://github.com/HamletDuFromage/aio-switch-updater/releases/download/2.23.2/aio-switch-updater.zip
https://github.com/ndeadly/MissionControl/releases/download/v0.10.0/MissionControl-0.10.0-master-38c9879.zip

What could be possibly causing these issues? Are these archives being created differently?

read from blob

Hello. Glory to Ukraine!

I have

<input type='file' onchange='on7z' accept='.7z'>
import SevenZip from "7z-wasm";

cosnt on7z = async (e) => {
  const sevenZip = await SevenZip();
  // how to read e.target.file[0] ?
}

How to process absolute path filfes

Can we use absolute path for files?
If I run the command:

npx 7z-wasm l archive.7z

which the working directory contains archive.7z and the command run successfully.
But if I run the command in a directory which not contains archive file and use the absolute path like:

npx 7z-wasm l /Users/username/Desktop/archive.7z

It says:

Scanning the drive for archives:

ERROR: errno=44 : No such file or directory
/Users/username/Desktop/archive.7z

exception thrown: 5406976

npx 7z-wasm failed to parse url error

on running npx 7z-wasm on cli getting error

TypeError: Failed to parse URL from <path>/node_modules/7z-wasm/7zz.wasm at Object.fetch (node:internal/deps/undici/undici:11457:11) { [cause]: TypeError [ERR_INVALID_URL]: Invalid URL

i'm using node v18.16

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.